Пример #1
0
        public ActionResult CreateEdit(UDesignation designation, string Action)
        {
            if (ModelState.IsValid)
            {
                if (!designation.Id.Equals(Guid.Empty))
                {
                    designation._Designation.CountryProgrammeId = countryProg.Id;
                    if (designationService.EditDesignation(designation._Designation))
                    {
                        designation = new UDesignation();
                        ModelState.Clear();
                    }
                }
                else
                {
                    designation._Designation.CountryProgrammeId = countryProg.Id;
                    if (designationService.AddDesignation(designation._Designation))
                    {
                        designation = new UDesignation();
                        ModelState.Clear();
                    }
                }
            }

            return(ListView());
        }
Пример #2
0
        public ActionResult Create(DesignationModel designationModel)
        {
            try
            {
                designationModel.RecLastUpdatedDt = DateTime.UtcNow;
                designationModel.RecLastUpdatedBy = User.Identity.GetUserId();
                // TODO: Add insert logic here
                if (designationModel.DesignationId > 0)
                {
                    designationService.UpdateDesignation(designationModel.MapClientToServer());
                }
                else
                {
                    designationModel.RecCreatedDt = DateTime.UtcNow;
                    designationModel.RecCreatedBy = User.Identity.GetUserId();

                    designationService.AddDesignation(designationModel.MapClientToServer());
                }
                TempData["message"] = new MessageViewModel
                {
                    IsSaved = true,
                    Message = "Your data has been saved successfully!"
                };
                return(RedirectToAction("Create"));
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
        public ActionResult <Designation> AddDesignation(Designation Designation)
        {
            int temp = _designationService.AddDesignation(Designation);

            if (temp > 0)
            {
                return(CreatedAtAction(nameof(Designation), new { id = temp }, Designation));
            }
            else
            {
                return(UnprocessableEntity("Designation already exist"));
            }
        }
 public ActionResult AddDesignation(DesignationViewModel designation)
 {
     if (ModelState.IsValid)
     {
         designationService.AddDesignation(designation);
         return(RedirectToAction("AddDesignation"));
     }
     else
     {
         ModelState.AddModelError("x", "Insertion failed");
         return(View(designation));
     }
 }
Пример #5
0
        public ActionResult AddDesignation(DesignationModel model)
        {
            bool flag = false;

            try
            {
                model.DesignationId = Guid.NewGuid();
                _DesignationServices.AddDesignation(model);
                flag = true;
            }
            catch (Exception ex)
            {
                flag = false;
            }
            Designation_Read();
            return(Json(flag));
        }
 public IActionResult Post([FromBody] DesignationModel value)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(BadRequest(ModelState));
         }
         RbacUser currentUser = HttpContext.Session.Get <RbacUser>("currentuser");
         value.CreatedBy = currentUser.EmployeeId;
         _designationService.AddDesignation(value);
         responseData.Results = _designationService.GetDesignation(value.DesignationId);
         responseData.Status  = "OK";
     }
     catch (Exception ex)
     {
         responseData.Status       = "Failed";
         responseData.ErrorMessage = ex.Message + " exception details:" + ex.ToString();
     }
     return(Ok(responseData));
 }
Пример #7
0
 public ActionResult AddDesignation(UDesignation model)
 {
     designationService.AddDesignation(model._Designation);
     return(Details(model._Designation.CountryProgrammeId));
 }