Exemple #1
0
        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 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));
 }