Esempio n. 1
0
 public static JobStatusViewModel MToVM(JobStatu model)
 {
     return(new JobStatusViewModel()
     {
         ID = model.ID,
         Description = model.Description
     });
 }
Esempio n. 2
0
 public ActionResult Edit(JobStatu jobstatus)
 {
     if (ModelState.IsValid)
     {
         objSourceMastersModel.SaveJobStatusById(jobstatus);
         ViewBag.SuccessMsg = "You have successfully updated Job Status.";
         return(View("Index", objSourceMastersModel.GetJobStatus()));
     }
     return(View(jobstatus));
 }
Esempio n. 3
0
        //
        // GET: /JobMode/Edit/5

        public ActionResult Edit(int id = 0)
        {
            JobStatu jobmode = objSourceMastersModel.GetJobStatusById(id);

            if (jobmode == null)
            {
                return(HttpNotFound());
            }
            return(View(jobmode));
        }
Esempio n. 4
0
        public ActionResult Edit(int guid)
        {
            JobStatu             model      = CarraraSQL.JobStatus.Find(guid);
            RouteValueDictionary parameters = Request.QueryString.ToRouteValues();

            if (model == null)
            {
                TempData["Page.Title"] = "Unable to Locate Job Status with Id " + guid.ToString() + "!";
                return(RedirectToAction("Index", parameters));
            }
            Page.Title = TempData["Page.Title"] != null ? TempData["Page.Title"].ToString() : "Edit " + model.JobStatusName;
            return(View("Manage", model));
        }
Esempio n. 5
0
        public ActionResult Add(JobStatu model)
        {
            RouteValueDictionary parameters = Request.QueryString.ToRouteValues();

            if (ModelState.IsValid)
            {
                CarraraSQL.JobStatus.Add(model);
                CarraraSQL.SaveChanges();
                TempData["Page.Title"] = "The Job Status Was Added Successfully!";
                return(RedirectToAction("Index", parameters));
            }
            // Failure is always an option...
            Page.Title   = "The Job Status Was NOT Added!";
            Page.Message = "Please correct the following errors:";
            return(View("Manage", model));
        }
Esempio n. 6
0
        public ActionResult Create(JobStatu jobstatus)
        {
            if (ModelState.IsValid)
            {
                var query = (from t in db.JobStatus where t.StatusName == jobstatus.StatusName select t).ToList();

                if (query.Count > 0)
                {
                    ViewBag.SuccessMsg = "Job Status is already exist";
                    return(View());
                }

                objSourceMastersModel.SaveJobStaus(jobstatus);
                ViewBag.SuccessMsg = "You have successfully added Job Status.";
                return(View("Index", objSourceMastersModel.GetJobStatus()));
            }

            return(View(jobstatus));
        }
Esempio n. 7
0
        public ActionResult Edit(JobStatu model)
        {
            RouteValueDictionary parameters = Request.QueryString.ToRouteValues();

            if (model.Action == "Delete")
            {
                JobStatu entity = CarraraSQL.JobStatus.Find(model.JobStatusID);
                if (entity.Jobs.Any())
                {
                    Page.Title   = "The Job Status Is In Use And Was NOT Deleted!";
                    Page.Message = "Set the Job Status to Inactive if you do not intend to use this Job Status again.";
                    return(View("Manage", model));
                }
                try
                {
                    CarraraSQL.JobStatus.Attach(model);
                    CarraraSQL.JobStatus.Remove(model);
                    CarraraSQL.SaveChanges();
                    TempData["Page.Title"] = "The Job Status Was Deleted Successfully";
                    return(RedirectToAction("Index", parameters));
                }
                catch (Exception ex)
                {
                    Page.Title = "The Job Status Was NOT Deleted! " + ex.Message;
                    return(View("Manage", model));
                }
            }
            if (ModelState.IsValid)
            {
                CarraraSQL.Entry(model).State = EntityState.Modified;
                CarraraSQL.SaveChanges();
                TempData["Page.Title"] = "The Job Status Was Updated Successfully";
                return(RedirectToAction("Index", parameters));
            }
            Page.Title   = "The Job Status Was NOT Updated!";
            Page.Message = "Please correct the following errors:";
            return(View("Manage", model));
        }
Esempio n. 8
0
        public ActionResult editjobstatus(JobStatu data)
        {
            if (!UserAuthentication.Identity().UserSystemRoles.Any(x => x.systemroleid == 1))
            {
                return(View("error"));
            }

            if (ModelState.IsValid)
            {
                try
                {
                    db.Entry(data).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();

                    return(Redirect("/jobstatus"));
                }
                catch (Exception e)
                {
                    return(RedirectToAction("Error500", "Home", new { errormsg = e.Message }));
                }
            }

            return(View(data));
        }
Esempio n. 9
0
        public async Task <List <JobInfoDto> > GetListByJobStatuAsync(JobStatu jobStatu)
        {
            var result = await _repository.GetListByJobStatuAsync(jobStatu);

            return(ObjectMapper.Map <List <JobInfo>, List <JobInfoDto> >(result));
        }
Esempio n. 10
0
 public async Task <List <JobInfo> > GetListByJobStatuAsync(JobStatu jobStatu)
 {
     return(await DbContext.JobInfos.Where(p => p.JobStatus == jobStatu).ToListAsync());
 }
Esempio n. 11
0
 public JobStatusController()
 {
     uow  = new UnitOfWork();
     repo = new JobStatu(uow);
 }