public ServiceDeliveryResponse Delete(Guid identifier) { ServiceDeliveryResponse response = new ServiceDeliveryResponse(); try { ServiceDelivery deletedServiceDelivery = unitOfWork.GetServiceDeliveryRepository().Delete(identifier); unitOfWork.Save(); response.ServiceDelivery = deletedServiceDelivery.ConvertToServiceDeliveryViewModel(); response.Success = true; } catch (Exception ex) { response.ServiceDelivery = new ServiceDeliveryViewModel(); response.Success = false; response.Message = ex.Message; } return(response); }
public ServiceDeliveryResponse Create(ServiceDeliveryViewModel re) { ServiceDeliveryResponse response = new ServiceDeliveryResponse(); try { ServiceDelivery addedServiceDelivery = unitOfWork.GetServiceDeliveryRepository().Create(re.ConvertToServiceDelivery()); unitOfWork.Save(); response.ServiceDelivery = addedServiceDelivery.ConvertToServiceDeliveryViewModel(); response.Success = true; } catch (Exception ex) { response.ServiceDelivery = new ServiceDeliveryViewModel(); response.Success = false; response.Message = ex.Message; } return(response); }