示例#1
0
        public async Task <ActionResult> Edit(string id)
        {
            var passport = await passportService.GetByIdAsync(id);

            if (passport != null)
            {
                HepaPassportEditViewModel model = new HepaPassportEditViewModel(passport.Id, passport.ExpiryDate, passport.Code);
                return(View(model));
            }
            return(View());
        }
示例#2
0
        public async Task <ActionResult> Edit(HepaPassportEditViewModel model)
        {
            if (ModelState.IsValid)
            {
                var passport = await passportService.GetByIdAsync(model.PassportCode);

                if (passport != null)
                {
                    passport.ExpiryDate = model.Expirydate;
                    passport.Code       = model.ActiveCode;
                    await passportService.UpdateAsync(passport);
                }
            }
            return(View());
        }