public IActionResult DetailsView(JobActivityViewModel vm) { if (ModelState.IsValid) { Activitity act = new Activitity { Name = vm.Name, Date = vm.Date, Description = vm.Description, RemarkId = vm.RemarkId, Remark = remark.GetRemark(vm.RemarkId), JobRole = vm.Job }; JobRole role = serve.GetJobByActivity(vm); if (role == null) { return(NotFound()); } vm.Job = role; act.JobRole = role; activitity.Create(act); vm = GetJobActivityViewModel(role); vm.JobId = role.Id; //return RedirectToAction("Index"); return(View(vm)); } return(View(vm)); }
public void Update(int id, Activitity obj) { var entity = context.Set <Activitity>().Find(id); context.Entry <Activitity>(entity).CurrentValues.SetValues(obj); //context.Set<Activitity>().Update(entity); context.SaveChanges(); }
public ActionResult Create(Activitity activitity, int Remarkid) { if (ModelState.IsValid) { try { // TODO: Add insert logic here //activitity.Remark = remark.GetRemark(Remarkid); serve.Create(activitity); return(RedirectToAction(nameof(Index))); } catch (Exception ex) { return(View(ex.Message)); } } return(View(ModelState)); }
public ActionResult Edit(int id, Activitity activitity, int RemarkId, int?JobRoleId) { if (ModelState.IsValid) { try { // TODO: Add update logic here //activitity.Remark = remark.GetRemark(RemarkId); serve.Update(id, activitity); return(RedirectToAction(nameof(Index))); } catch (Exception ex) { return(View(ex.Message)); } } return(View(ModelState)); }
public void Create(Activitity activity) { context.Set <Activitity>().Add(activity); context.SaveChanges(); }