예제 #1
0
        public IActionResult EditWarrantyModal(Models.Warranty.EditWarranty model)
        {
            if (ModelState.IsValid)
            {
                WarrantyDto dto = new WarrantyDto
                {
                    WarrantyId          = model.WarrantyId,
                    EndDate             = model.EndDate.ToUniversalTime(),
                    StartDate           = model.StartDate.ToUniversalTime(),
                    TeamId              = model.TeamId,
                    UserId              = model.UserId,
                    WarrantyName        = model.WarrantyName,
                    WarrentyDescription = model.WarrentyDescription
                };

                if (model.IsAddNew)
                {
                    model.Result = WarrantyService.AddWarranty(dto);
                }
                else
                {
                    model.Result = WarrantyService.UpdateWarranty(dto);
                }
            }
            else
            {
                model.FillTeamsSelectList(TeamService.GetTeams());
                model.UserSelectList = new List <SelectListItem>();
            }

            return(PartialView("_WarrantyEditPartial", model));
        }
예제 #2
0
        public IActionResult EditWarrantyModal(string id)
        {
            Guid?warrantyId = Helper.ConvertToGuid(id);
            var  teams      = TeamService.GetTeams();

            Models.Warranty.EditWarranty model;
            if (warrantyId.HasValue)
            {
                model = new Models.Warranty.EditWarranty(WarrantyService.GetWarranty(warrantyId.Value), teams);
            }
            else
            {
                model = new Models.Warranty.EditWarranty(teams);
            }

            return(PartialView("_WarrantyEditPartial", model));
        }