public IActionResult Kayit(int?Id) { var result = new LoginData.Models.User(); if (Id.HasValue && Id > 0) { LoginData.Services.UserServices services = new LoginData.Services.UserServices(); result = services.GetById(Id.Value); } return(View(result)); }
public IActionResult Kayit(LoginData.Models.User data) { LoginData.Services.UserServices services = new LoginData.Services.UserServices(); var result = services.Save(data); if (result > 0) { return(RedirectToAction("Index")); } return(View()); }
public bool Kayit(LoginData.Models.User registration) { bool result = true; using (var srv = new Models.KampContext()) { if (registration.Id > 0) { } else { srv.Users.Add(registration); } srv.SaveChanges(); } return(result); }
//public object Kayit(int email, int password, int userName) //{ // throw new NotImplementedException(); //} public int Save(LoginData.Models.User data) { int result = 0; using (var srv = new KampContext()) { if (data.Id > 0) { //srv.Users.Update(data); var currentModel = srv.Users.FirstOrDefault(I => I.Id == data.Id); currentModel.Email = data.Email; currentModel.Password = data.Password; currentModel.Name = data.Name; } else { srv.Users.Add(data); } srv.SaveChanges(); } return(result); }