コード例 #1
0
 public ActionResult Edit(long id)
 {
     AccountValueViewModel model = new 
         AccountValueViewModel(service.GetSingle(id.ToString(),AuthenticationHelper.User.CompanyId));
     model.SetOfBook = sobService.GetSingle(accountService.GetSingle(model.ChartId.ToString(), AuthenticationHelper.User.CompanyId).SOBId.ToString(), AuthenticationHelper.User.CompanyId).Name;
     return View(model);
 }
コード例 #2
0
        public ActionResult Create(long sobId, string segment)
        {
            AccountValueViewModel model = new AccountValueViewModel();
            if (accountService.GetAccountBySOBId(sobId.ToString(), AuthenticationHelper.User.CompanyId) != null)
            {
                model.ChartId = accountService.GetAccountBySOBId(sobId.ToString(), AuthenticationHelper.User.CompanyId).Id;
                model.SetOfBook = sobService.GetSingle(sobId.ToString(),AuthenticationHelper.User.CompanyId).Name;
                model.Segment = segment;
                return View("Edit", model);
            }

            return RedirectToAction("Index");
        }
コード例 #3
0
        public ActionResult Edit(AccountValueViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (model.Id > 0)
                {
                    string result = service.Update(mapModel(model));
                    return RedirectToAction("Index");
                }
                else
                {
                    string result = service.Insert(mapModel(model));
                    return RedirectToAction("Index");
                }
            }

            return View(model);
        }
コード例 #4
0
 private AccountValue mapModel(AccountValueViewModel model)            ////TODO: this should be done in service will discuss later - FK
 {
     return new AccountValue
     {
         AccountType = model.AccountType,
         ChartId = model.ChartId,
         CreateDate = DateTime.Now,
         EndDate = model.EndDate,
         Id = model.Id,
         Levl = model.Levl,
         Segment = model.Segment,
         StartDate = model.StartDate,
         UpdateDate = DateTime.Now,
         Value = model.Value,
         ValueName = model.ValueName
     };
 }