public IHttpActionResult PutEmployee(int id, Employee employee) { if (id != employee.EmployeeId) { return(BadRequest()); } db.Entry(employee).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EmployeeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Create(Employee employee) { if (ModelState.IsValid) { db.Employees.Add(employee); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(employee)); }
public ActionResult Create(Login login) { if (ModelState.IsValid) { login.UserId = DateTime.UtcNow.ToString(); db.Logins.Add(login); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(login)); }