コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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);
            }
        }