// [TypeFilter(typeof(AuthorizeAction), Arguments = new object[] { "Write" })]
        public IActionResult Index()
        {
            OccupationViewModel model = new OccupationViewModel();

            InitAccessModel(model);
            return(View(model));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> OccupationInfo([FromForm] OccupationViewModel model)
        {
            string attachPath = string.Empty;

            if (model.formFile != null)
            {
                string fileName;
                string message = FileSave.SaveImage(out fileName, "Upload/Attachment/OccupationFile", model.formFile);

                if (message == "success")
                {
                    attachPath = fileName;
                }
            }
            Occupation occupation = new Occupation
            {
                Id        = (int)model.occupationId,
                name      = model.name,
                nameBn    = model.nameBn,
                imagePath = attachPath
            };
            await lostAndFoundType.SaveOccupation(occupation);

            return(RedirectToAction(nameof(OccupationInfo)));
        }
Ejemplo n.º 3
0
        public OccupationViewModel Update(OccupationViewModel occupationViewModel)
        {
            var occupation = Mapper.Map <Occupation>(occupationViewModel);

            _occupationRepository.Update(occupation);

            return(occupationViewModel);
        }
Ejemplo n.º 4
0
        public OccupationViewModel Add(OccupationViewModel occupationViewModel)
        {
            var occupation = Mapper.Map <Occupation>(occupationViewModel);

            var occupationRet = _occupationRepository.Add(occupation);

            return(occupationViewModel);
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> OccupationInfo()
        {
            OccupationViewModel model = new OccupationViewModel
            {
                occupations = await lostAndFoundType.GetOccupation(),
                fLang       = _oLang.PerseLang("MasterData/DocumentTypeEN.json", "MasterData/DocumentTypeBN.json", Request.Cookies["lang"]),
            };

            return(View(model));
        }
        /// <summary>
        /// Get the Data based on ID and return to the model to update view.
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        // [TypeFilter(typeof(AuthorizeAction), Arguments = new object[] { "Write" })]
        public IActionResult Update(int ID)
        {
            OccupationViewModel model = new OccupationViewModel();

            model.OccupationMaster = _occupationService.GetData(ID);

            if (model != null)
            {
                //InitAccessModel(model);
                return(View("Index", model));
            }
            else
            {
                return(View("SummaryView", model));
            }
        }
        public IActionResult AddUpdate(OccupationViewModel model)
        {
            JsonResponse response = new JsonResponse();

            // If the model valid go to the next level
            if (ModelState.IsValid)
            {
                response = _occupationService.AddUpdate(model.OccupationMaster);
                return(Json(response));
            }// Else it  shows the error message.
            else
            {
                JsonResponse resp = new JsonResponse
                {
                    Message = Constants.ControllerMessage.All_Fields_Mandatory
                };
                return(Json(resp));
            }
        }
 // PUT: api/Customers/5
 public void Put(int id, [FromBody] OccupationViewModel occupationViewModel)
 {
     _occupationAppService.Update(occupationViewModel);
 }
 // POST: api/Customers
 public void Post([FromBody] OccupationViewModel occupationViewModel)
 {
     _occupationAppService.Add(occupationViewModel);
 }
Ejemplo n.º 10
0
 public PersonViewModel(PersonModel model)
 {
     this.model = model;
     this.occupationViewModel = new OccupationViewModel(this.model.occupation);
 }