public CreateMethodResponse Create(CreateMethodRequest request) { var response = new CreateMethodResponse(); try { var method = request.MapTo<Method>(); DataContext.Methods.Add(method); DataContext.SaveChanges(); response.IsSuccess = true; response.Message = "Method item has been added successfully"; } catch (DbUpdateException dbUpdateException) { response.Message = dbUpdateException.Message; } return response; }
public CreateMethodResponse Create(CreateMethodRequest request) { var response = new CreateMethodResponse(); try { var method = request.MapTo <Method>(); DataContext.Methods.Add(method); DataContext.SaveChanges(); response.IsSuccess = true; response.Message = "Method item has been added successfully"; } catch (DbUpdateException dbUpdateException) { response.Message = dbUpdateException.Message; } return(response); }