public SpecialAreaResponse Add(SpacialArea specialArea) { SpecialAreaResponse response = new SpecialAreaResponse(); try { _repositorySpacial.Add(specialArea); _unitOfWork.SaveChanges(); response.SetStatus(Common.Constants.ResponseCode.SUCCESS); return(response); } catch (Exception ex) { response.SetStatus(Common.Constants.ResponseCode.FAILED_ON_DB_PROCESS, ex.Message); return(response); } }
public SpecialAreaResponse GetSpecialAreaByID(int ID) { SpecialAreaResponse response = new SpecialAreaResponse(); try { SpacialArea spacialarea = _repositorySpacial.Get(t => t.ID == ID).FirstOrDefault(); response.SpecialAreas.Add(new SpecialAreaModel { Name = spacialarea.Name, Description = spacialarea.Description, ID = spacialarea.ID }); response.SetStatus(Common.Constants.ResponseCode.SUCCESS); return(response); } catch (Exception exception) { response.SetStatus(Common.Constants.ResponseCode.FAILED_ON_DB_PROCESS, exception.Message); return(response); } }
public SpecialAreaResponse GetSpecialAreas() { SpecialAreaResponse response = new SpecialAreaResponse(); try { foreach (var item in _repositorySpacial.Get().ToList()) { response.SpecialAreas.Add(new SpecialAreaModel { ID = item.ID, Name = item.Name, Description = item.Description }); } response.SetStatus(Common.Constants.ResponseCode.SUCCESS); return(response); } catch (Exception ex) { response.SetStatus(Common.Constants.ResponseCode.FAILED_ON_DB_PROCESS, ex.Message); return(response); } }