public object GetClientParametersObject(ClientModel model) { object result = null; switch (model.ImportTypeId) { case 1: if (model.ClientParameters == null) { using (DomainContext ctx = new DomainContext()) { Manager mgr = new Manager(ctx); var existingProperties = ctx.Client.SingleOrDefault(x => x.Id == model.Id); if (existingProperties != null) { model.ClientParameters = existingProperties.ClientParameters; result = new MindBodyParameters { StudioID = model.ClientParameters.Element("StudioID").Value, Sourcename = model.ClientParameters.Element("Sourcename").Value, Password = model.ClientParameters.Element("Password").Value }; } else { result = new MindBodyParameters(); } } } break; default: break; } return result; }
ClientParametersObject GetClientParametersObject(ClientModel model, NameValueCollection requestParameters) { ClientParametersObject result = new ClientParametersObject(); if (model.ImportTypeId == 1) { MindBodyParameters parameters = new MindBodyParameters(); parameters.StudioID = requestParameters["ClientParametersStudioID"]; parameters.Sourcename = requestParameters["ClientParametersSourcename"]; parameters.Password = requestParameters["ClientParametersPassword"]; result = parameters; } return result; }