Esempio n. 1
0
        public IActionResult GetUpdateComponent(Component model)
        {
            BackEnd.Models.Component component = new BackEnd.Models.Component();
            component.ComponentId = model.ComponentId;
            ComponentHandler handler = new ComponentHandler(new bachelordbContext());
            var newcomp = handler.getComponent(component);

            if (newcomp.Status != null)
            {
                newcomp.AdminComment             = model.AdminComment;
                newcomp.ComponentNumber          = model.ComponentNumber;
                newcomp.SerialNo                 = model.SerialNo;
                newcomp.UserComment              = model.UserComment;
                newcomp.Status                   = model.Status.ToString();
                newcomp.CurrentLoanInformationId = Convert.ToInt64(User.Claims.ElementAt(3).Value);
                handler.EditComponent(newcomp);

                return(RedirectToAction("Index", "HomePage"));
            }
            else
            {
                this.ModelState.AddModelError("AdminComment", "There is no component with that ID");
                return(View("ViewUpdateComponent"));
            }
        }
Esempio n. 2
0
        public IActionResult DeleteComponent(Component model)
        {
            BackEnd.Models.Component component = new BackEnd.Models.Component();
            component.ComponentId = model.ComponentId;
            ComponentHandler handler = new ComponentHandler(new bachelordbContext());

            handler.DeleteComponent(component);
            return(RedirectToAction("Index", "HomePage"));
        }
Esempio n. 3
0
        public IActionResult CreateComponent(Component model)
        {
            BackEnd.Models.Component component = new BackEnd.Models.Component();
            component.AdminComment             = model.AdminComment;
            component.ComponentNumber          = model.ComponentNumber;
            component.SerialNo                 = model.SerialNo;
            component.UserComment              = model.UserComment;
            component.Status                   = model.Status.ToString();
            component.CurrentLoanInformationId = Convert.ToInt64(User.Claims.ElementAt(3).Value);
            ComponentHandler handler = new ComponentHandler(new bachelordbContext());

            handler.saveComponent(component, Int32.Parse(model.selectedCompentype));
            return(RedirectToAction("Index", "HomePage"));
        }