Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ClientId,EnteringDate,Name,Follow,IsGood,IsSale,EnteringStaff,Branch,Note")] BrhClient brhClient)
        {
            if (id != brhClient.ClientId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    brhClient.EnteringDate = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById("China Standard Time"));
                    _context.Update(brhClient);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BrhClientExists(brhClient.ClientId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(PartialView("~/Areas/Branch/Views/BrhClient/CreateEdit.cshtml", brhClient));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("ClientId,EnteringDate,Name,Follow,IsGood,IsSale,EnteringStaff,Branch,Note")] BrhClient brhClient)
        {
            if (ModelState.IsValid)
            {
                brhClient.EnteringDate = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById("China Standard Time"));
                _context.Add(brhClient);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(PartialView("~/Areas/Branch/Views/BrhClient/CreateEdit.cshtml", brhClient));
        }