public ActionResult AccountToggle(AccountViewModel account) { ClientLogic clientLogic = new ClientLogic(); Client client = clientLogic.GetClientByClientGuid(account.ClientGuid); if (null == client) { return RedirectToAction("See"); } // toggle account paused flag client.AccountPaused = !account.PauseAccount; clientLogic.UpdateClient(client); return RedirectToAction("See"); }
private void SaveAccount(ClientLogic clientLogic, AccountViewModel account, MembershipUser user, bool insert) { // Call business logic to insert the data. // todo: move to mapping CityStateZip cityStateZip = new CityStateZip { City = account.City, State = account.State, ZipCode = account.ZipCode }; this.AddCityStateZipToAccount(account, cityStateZip); PaymentInfo paymentInfo = new PaymentInfo { AmazonToken = User.Identity.Name }; this.AddPaymentInfoToAccount(account, paymentInfo); Client client = new Client(); client.ClientName = account.ClientName; client.PhoneNumber = account.PhoneNumber; client.Email = user.UserName; client.Address = account.Address; client.CityStateZipGuid = account.CityStateZipGuid; client.PaymentInfoGuid = account.PaymentInfoGuid; // pause account - in create view is always false client.AccountPaused = account.PauseAccount; if (insert) { if (SessionHandler.Current.GitAssertion != null) { GitAssertion assertion = SessionHandler.Current.GitAssertion; client.FederatedIDProvider = assertion.Authority; client.FederatedID = assertion.Identifier; client.FederatedKey = user.ProviderUserKey.ToString(); } client = clientLogic.InsertClient(client); account.ClientGuid = client.ClientGuid; account.ClientID = client.ClientID; } else { client.IsWaiverd = account.IsWaiverd; client.FreeDays = account.FreeDays; client.Credits = account.AccountBalance; client.IsSuspended = account.IsSuspended; client.IsActive = account.IsActive; client.ClientGuid = account.ClientGuid; // Had to add this...... clientLogic.UpdateClient(client); } }
public void UpdateClient(DC.Client request) { try { BL.ClientLogic clientLogic = new BL.ClientLogic(); BE.Client entity = request.ToBusinessEntity(); clientLogic.UpdateClient(entity); } catch (BE.ClientNotFoundException ex) { FC.DefaultFaultContract fault = new FC.DefaultFaultContract(); fault.ErrorMessage = String.Format( "Unable to update Client data. Data: {0}", request.ToBusinessEntity().ToString()); throw new FaultException<FC.DefaultFaultContract>(fault, new FaultReason(ex.Message)); } }