public ActionResult Create(CustomerViewModel cvm) { try { string user = LoggedInuser.LoggedInUser(); cvm.CustomerModel.DateCreated = DateTime.Now; customer.DateCreated = DateTime.Now; customer.IsVisible = "1"; customer.OutstandingAmount = 0; customer.ValueDate = DateTime.Now.Date.ToString(); customer.ValueTime = DateTime.Now.TimeOfDay.ToString(); cvm.CustomerModel.DateCreated = DateTime.Now; cvm.CustomerModel.IsVisible = "1"; cvm.CustomerModel.OutstandingAmount = 0; cvm.CustomerModel.ValueDate = DateTime.Now.Date.ToString(); cvm.CustomerModel.ValueTime = DateTime.Now.TimeOfDay.ToString(); cvm.CustomerModel.User_FK = DataReaders.GetUserIdByEmail(Email); // cvm.CustomerModel.User_FK = 1; if (cvm.CustomerModel.ContactEmail != null) { var customerRecord = DataReaders.ValidateCustomer(cvm.CustomerModel.ContactEmail); if (customerRecord == false) { gc.CreateCustomer(cvm.CustomerModel); TempData["Message"] = "Customer Added Succesfully"; return(RedirectToAction("Index")); } else { TempData["Message"] = "Error Please Try Again! "; return(View("create")); } } return(View("create")); } catch (Exception ex) { WebLog.Log(ex.Message.ToString()); return(null); } }
public ActionResult AgentWallet() { try { string user = LoggedInuser.LoggedInUser(); if (user != null) { int userid = DataReaders.GetUserIdByEmail(user); var Balance = DataReaders.Balance(userid); TempData["Balance"] = Balance; return(View()); } else { return(RedirectToAction("Index", "Index")); } } catch (Exception ex) { WebLog.Log(ex.Message.ToString()); return(null); } }