Guest User

Guest User

  • Tech Writer
  • 611
  • 128.2k

Update record in web api.

Mar 6 2020 12:31 AM
I have updated a record in c# web api. I want only first name and last name update but i have check database first name and last name update but other field null .
 
pls solve isssue. 
 
public UserEditResponse EditAppProfile(UserDetails objParam)
{
UserEditResponse obj = new UserEditResponse();
UserDetails obj_EditUser = new UserDetails();
try
{
var user = _db.FranchiseMasters.Where(x => x.IdFranchise == objParam.UserId).FirstOrDefault();
if (user != null)
{
user.FirstName = objParam.FirstName;
user.LastName = objParam.LastName;
user.PhoneNumber = objParam.PhoneNumber;
user.ProfileImage = objParam.ProfileImage;
user.Email = objParam.Email;
user.Password = objParam.Password;
user.Address = objParam.Address;
user.CreatedDate = DateTime.Now;
//user.IsVerifiedByOtp = objParam.IsVerifiedByOtp;
user.TokenFCM = objParam.TokenFCM;
user.LoginType = objParam.LoginType;
user.LastLogin = objParam.LastLogin;
user.AuthenticationId = objParam.AuthenticationId;
user.DeviceType = objParam.DeviceType;
_db.SaveChanges();
obj.Response = 1;
obj.ErrorMessage = "No Error Found";
 
 
it's me code. 

Answers (7)