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; }
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); }