public ActionResult Create(ColourModel model)
        {
            if (ModelState.IsValid)
            {
                colourService.Add(model);

                TempData["Success"] = $"{model.ColourName} colour Added !!";

                return(RedirectToAction("Index"));
            }

            return(View(@"~\Views\Configuration\Colour\Create.cshtml"));
        }
        public ActionResult Create(EducationLevelModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    educationService.Add(model);

                    TempData["Success"] = $"{model.LevelName} Added !";

                    return(RedirectToAction("Index"));
                }
                return(View(@"~\Views\Configuration\Education\Create.cshtml", model));
            }
            catch (Exception e)
            {
                TempData["Danger"] = $"Opps something went wrong {e.Message}";

                throw;
            }
        }
        public ActionResult Create(DesignationModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    model.CreatedDate = DateTime.Now;

                    designService.Add(model);

                    TempData["Success"] = $"{model.DesgName} Added !!";

                    return(RedirectToAction("Index"));
                }

                TempData["Danger"] = "Form Error";
            }
            catch (Exception e)
            {
                TempData["Danger"] = $"Opppps something went wrong {e.Message}";
            }

            return(View(@"~\Views\Configuration\Designation\Create.cshtml"));
        }
Exemple #4
0
        public ActionResult Create(OfficeTypeModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    model.CreatedDate = DateTime.Now;

                    officeTypeService.Add(model);

                    TempData["Success"] = $"{model.OfficeTypeName} Added !";

                    return(RedirectToAction("Index"));
                }

                return(View(@"~\Views\Configuration\OfficeType\Create.cshtml", model));
            }
            catch (Exception e)
            {
                TempData["Danger"] = $"Oppss Something went wrong {e.Message} !";

                throw;
            }
        }