public ActionResult Add(UserVM model) { FF_USER tempUser = new FF_USER() { IDENTITY_NUMBER = model.IdentityNumber, FIRSTNAME = model.Firstname, LASTNAME = model.Lastname, GENDER = model.Gender, DATE_OF_BIRTH = model.DateOfBirth, MAIL_ADDRESS = model.MailAddress, PHONE_NUMBER = model.PhoneNumber, WORK_ADDRESS = model.WorkAddress, IS_FARMER = model.IsFarmer, PASSWORD = Base64Cipher.Encode("Aa123456") }; var user = _dbUnit.Repo <FF_USER>().Add(tempUser); if (user != null) { return(Ok($"{tempUser.IDENTITY_NUMBER} numaralı kullanıcı eklendi.")); } else { return(BadRequest($"{tempUser.IDENTITY_NUMBER} numaralı kullanıcı eklenemedi..")); } }
public ActionResult Update(UserVM model) { using (FromFarmerContext ctx = new FromFarmerContext()) { var user = ctx.FF_USER.Where(x => x.IDENTITY_NUMBER == model.IdentityNumber).FirstOrDefault(); if (user != null) { FF_USER tempUser = new FF_USER() { ID = user.ID, IDENTITY_NUMBER = model.IdentityNumber, FIRSTNAME = model.Firstname, LASTNAME = model.Lastname, GENDER = model.Gender, DATE_OF_BIRTH = model.DateOfBirth, MAIL_ADDRESS = model.MailAddress, PHONE_NUMBER = model.PhoneNumber, WORK_ADDRESS = model.WorkAddress, IS_FARMER = model.IsFarmer }; var userResult = _dbUnit.Repo <FF_USER>().Update(tempUser); if (userResult != null) { return(Ok($"{model.IdentityNumber} numaralı kullanıcı güncellendi.")); } else { return(BadRequest($"{model.IdentityNumber} numaralı kullanıcı güncellenemedi..")); } } else { return(BadRequest($"{model.IdentityNumber} numaralı kullanıcı bulunamadı..")); } } }