public GeneralResponse EditNetworkCenter(EditNetworkCenterRequest request) { GeneralResponse response = new GeneralResponse(); NetworkCenter networkCenter = new NetworkCenter(); Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); Criterion criteria1 = new Criterion("Network.ID", request.NetworkID, CriteriaOperator.Equal); Criterion criteria2 = new Criterion("Center.ID", request.CenterID, CriteriaOperator.Equal); query.Add(criteria1); query.Add(criteria2); networkCenter = _networkCenterRepository.FindBy(query).FirstOrDefault(); if (networkCenter != null) { try { networkCenter.Status = (NetworkCenterStatus)request.Status; networkCenter.CanSale = request.CanSale; if (networkCenter.GetBrokenRules().Count() > 0) { foreach (BusinessRule businessRule in networkCenter.GetBrokenRules()) { response.ErrorMessages.Add(businessRule.Rule); } return(response); } _networkCenterRepository.Save(networkCenter); _uow.Commit(); ////response.success = true; } catch (Exception ex) { response.ErrorMessages.Add(ex.Message); } } else { response.ErrorMessages.Add("NoItemToEditKey"); } return(response); }
public GeneralResponse EditCoverage(IEnumerable <NetworkCenterView> requests, Guid CenterID) { GeneralResponse response = new GeneralResponse(); foreach (var request in requests) { try { NetworkCenter networkCenter = new NetworkCenter(); Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); Criterion criteria = new Criterion("Network.ID", request.NetworkID, CriteriaOperator.Equal); query.Add(criteria); criteria = new Criterion("Center.ID", CenterID, CriteriaOperator.Equal); query.Add(criteria); networkCenter = _networkCenterRepository.FindBy(query).FirstOrDefault(); networkCenter.Status = (NetworkCenterStatus)request.StatusInt; _networkCenterRepository.Save(networkCenter); } catch (Exception ex) { response.ErrorMessages.Add(ex.Message); return(response); } } try { _uow.Commit(); } catch (Exception ex) { response.ErrorMessages.Add(ex.Message); return(response); } return(response); }