Sourabh Dhiman

Sourabh Dhiman

  • 1.7k
  • 185
  • 6.2k

Registration A Data in table.

Mar 31 2020 11:51 PM
UserMaster obj_usermaster = new UserMaster();
try
{
var usercheck = _db.UserMasters.Where(x => x.Email == Obj_Parameter.Email && x.IsActive == true).FirstOrDefault();
if (usercheck != null)
{
// UserMaster objuser = new UserMaster();
obj_usermaster.UserName = Obj_Parameter.UserName;
obj_usermaster.Email = Obj_Parameter.Email;
obj_usermaster.UserRoleId = Obj_Parameter.UserRoleId;
obj_usermaster.IsActive = true;
obj_usermaster.Password = Obj_Parameter.Password;
obj_usermaster.CreatedDate = DateTime.UtcNow;
_db.UserMasters.Add(obj_usermaster);
_db.SaveChanges();
obj_Response.Response = 1;
obj_Response.ErrorMessage = "Registration Successful.\nUser Id: " + usercheck.UserId.ToString();
obj_Response.UserId = usercheck.UserId;
 
It's me sign up code .Store null value .What's problem this code. 

Brought to you by:

Answers (3)