示例#1
0
        public CreatePillarResponse Create(CreatePillarRequest request)
        {
            var response = new CreatePillarResponse();
            try
            {
                var pillar = request.MapTo<Pillar>();
                DataContext.Pillars.Add(pillar);
                DataContext.SaveChanges();
                response.IsSuccess = true;
                response.Message = "Pillar item has been added successfully";
            }
            catch (DbUpdateException dbUpdateException)
            {
                response.Message = dbUpdateException.Message;
            }

            return response;
        }
示例#2
0
        public CreatePillarResponse Create(CreatePillarRequest request)
        {
            var response = new CreatePillarResponse();

            try
            {
                var pillar = request.MapTo <Pillar>();
                DataContext.Pillars.Add(pillar);
                DataContext.SaveChanges();
                response.IsSuccess = true;
                response.Message   = "Pillar item has been added successfully";
            }
            catch (DbUpdateException dbUpdateException)
            {
                response.Message = dbUpdateException.Message;
            }

            return(response);
        }