Guest User

Guest User

  • Tech Writer
  • 611
  • 128.1k

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. 

Answers (3)