public ProjectPropertiesResponse ProjectProperties([FromBody] BaseRequest request) { ProjectPropertiesResponse response = new ProjectPropertiesResponse(); List <MProgramName> programNames = new List <MProgramName>(); List <MDonorPartner> donorPartners = new List <MDonorPartner>(); try { if (!BAplication.ValidateAplicationToken(request.ApplicationToken)) { response.Code = "2"; response.Message = Messages.ApplicationTokenNoAutorize; return(response); } programNames = BProgramName.List(); donorPartners = BDonorPartner.List(); response.Code = "0"; response.Message = "Success"; response.ProgramNames = programNames.ToArray(); response.DonorPartners = donorPartners.ToArray(); } catch (Exception ex) { response.Code = "2"; response.Message = ex.Message; } return(response); }
public ProgramNamesResponse GetProgramNames([FromBody] BaseRequest request) { ProgramNamesResponse response = new ProgramNamesResponse(); try { if (!BAplication.ValidateAplicationToken(request.ApplicationToken)) { response.Code = "2"; response.Message = Messages.ApplicationTokenNoAutorize; return(response); } List <MProgramName> programNames = BProgramName.List(); response.ProgramNames = programNames.ToArray(); response.Code = "0"; response.Message = "Success"; } catch (Exception ex) { response.Code = "2"; response.Message = ex.Message; } return(response); }
public BaseResponse InsertProgramName([FromBody] ProgramNamesRequest request) { BaseResponse response = new BaseResponse(); using (TransactionScope scope = new TransactionScope()) { try { if (!BAplication.ValidateAplicationToken(request.ApplicationToken)) { response.Code = "2"; response.Message = Messages.ApplicationTokenNoAutorize; return(response); } string webRoot = _env.ContentRootPath; string rootPath = _appSettings.Value.rootPath; string ProjectPath = _appSettings.Value.ProjectPath; BaseRequest baseRequest = new BaseRequest(); foreach (MProgramName model in request.ProgramNames) { MProgramName programName = new MProgramName(); programName.ProjectCode = model.ProjectCode; programName.ProgramName = model.ProgramName; programName.DonorCode = model.DonorCode; programName.ProjectDetails = model.ProjectDetails; programName.Sector = model.Sector; programName.TaskManager = model.TaskManager; BProgramName.Insert(programName); } response.Code = "0"; response.Message = "Success"; scope.Complete(); } catch (Exception ex) { response.Code = "2"; response.Message = ex.Message; scope.Dispose(); } } return(response); }