コード例 #1
0
        public async Task <IActionResult> EditAllowancePolicy(AllowancePolicy item)
        {
            var model = await _context.AllowancePolicies.SingleOrDefaultAsync(b => b.Id == item.Id);

            await TryUpdateModelAsync(model);

            model.LastUpdated = DateTime.Now.Date;
            model.UpdatedBy   = "user";
            await _context.SaveChangesAsync();

            string level;

            if (item.IsCompanyPolicy)
            {
                level = "ORG";
            }
            else if (item.GradeGroupId.HasValue)
            {
                level = "GRADE_GROUP";
            }
            else
            {
                level = "JOB_GRADE";
            }

            return(RedirectToAction("AllowancePoliciesList", new { level = level }));
        }
コード例 #2
0
        public async Task <IActionResult> AddAllowancePolicy(AllowancePolicy item, string level)
        {
            if (level == "ORG")
            {
                item.IsCompanyPolicy = true;
            }
            item.CreatedDate = DateTime.Now.Date;
            item.LastUpdated = DateTime.Now.Date;
            item.UpdatedBy   = "user";
            _context.AllowancePolicies.Add(item);
            await _context.SaveChangesAsync();

            return(RedirectToAction("AllowancePoliciesList", new { level = level }));
        }