public ActionResult Create(TaxSetting taxSetting) { try { var user = uService.GetSingleUserByEmail(HttpContext.User.Identity.Name); //var AccSet = sService.GetAllByUserId(user.Id); //taxSetting.CompanyId = Int32.Parse(AccSet.Companies.Id.ToString()); var logObj = _companyViewLog.GetLastViewCompanyByUserId(user.Id); int companyId = 0; if (logObj != null) { companyId = (int)logObj.CompanyId; } taxSetting.CompanyId = companyId; if (_taxSettingService.AddTaxSetting(taxSetting)) return RedirectToAction("Details", "TaxSetting", new { Area = "OrgSettings", id = taxSetting.Id }); else return Content("Data insert Failed"); } catch (Exception ex) { return Content(ex.Message); } }
public bool AddTaxSetting(TaxSetting taxSetting) { try { taxSetting.State = ObjectState.Added; _crudOperation.AddOperation(taxSetting); return true; } catch (Exception ex) { var errMsg = ex.Message; return false; } }
public ActionResult Edit(TaxSetting taxSetting) { try { if (_taxSettingService.UpdateTaxSetting(taxSetting)) return RedirectToAction("Details", "TaxSetting", new { Area = "OrgSettings", id = taxSetting.Id }); else { ModelState.AddModelError("msg", "Data Update Failed"); return View(); } } catch (Exception ex) { return Content(ex.Message); } }
public bool UpdateTaxSetting(TaxSetting taxSetting) { try { var dbObj = _crudOperation.GetSingleObject(taxSetting.Id); dbObj.DisplayName = taxSetting.DisplayName; dbObj.TaxBasis = taxSetting.TaxBasis; dbObj.TaxId = taxSetting.TaxId; dbObj.FinalcialPeriod = taxSetting.FinalcialPeriod; dbObj.State = ObjectState.Modified; _crudOperation.UpdateOperation(dbObj); return true; } catch (Exception ex) { var errMsg = ex.Message; return false; } }