コード例 #1
0
        public ProfessionResponse Create(ProfessionViewModel city)
        {
            ProfessionResponse response = new ProfessionResponse();

            try
            {
                Profession addedProfession = unitOfWork.GetProfessionRepository().Create(city.ConvertToProfession());
                unitOfWork.Save();

                response.Profession = addedProfession.ConvertToProfessionViewModel();
                response.Success    = true;
            }
            catch (Exception ex)
            {
                response.Profession = new ProfessionViewModel();
                response.Success    = false;
                response.Message    = ex.Message;
            }

            return(response);
        }
コード例 #2
0
        public ProfessionResponse Delete(Guid identifier)
        {
            ProfessionResponse response = new ProfessionResponse();

            try
            {
                Profession deletedProfession = unitOfWork.GetProfessionRepository().Delete(identifier);

                unitOfWork.Save();

                response.Profession = deletedProfession.ConvertToProfessionViewModel();
                response.Success    = true;
            }
            catch (Exception ex)
            {
                response.Profession = new ProfessionViewModel();
                response.Success    = false;
                response.Message    = ex.Message;
            }

            return(response);
        }