public int AddIncidentWorkOrder(IncidentWorkOrderDomain workOrder) { var incidentWorkOrderDb = new WorkOrder().FromDomainModel(workOrder); _context.WorkOrder.Add(incidentWorkOrderDb); _context.SaveChanges(); return(incidentWorkOrderDb.WorkOrderId); }
public void UpdateIncidentWorkOrder(IncidentWorkOrderDomain workOrder) { if (workOrder == null) { throw new NsiArgumentException(ExceptionMessages.ArgumentException); } _incidentWorkOrderRepository.UpdateIncidentWorkOrder(workOrder); }
public int AddIncidentWorkOrder(IncidentWorkOrderDomain workOrder) { if (workOrder == null) { throw new NsiArgumentException(ExceptionMessages.ArgumentException); } return(_incidentWorkOrderRepository.AddIncidentWorkOrder(workOrder)); }
public void UpdateIncidentWorkOrder(IncidentWorkOrderDomain workOrder) { if (workOrder == null) { throw new NsiArgumentNullException(ExceptionMessages.ArgumentException); } var incidentWorkOrderDb = _context.WorkOrder.FirstOrDefault(x => x.WorkOrderId == workOrder.WorkOrderId); if (incidentWorkOrderDb == null) { throw new NsiArgumentNullException(IncidentMessages.IncidentWorkOrderInvalidId); } incidentWorkOrderDb.FromDomainModel(workOrder); _context.SaveChanges(); }
public static WorkOrder FromDomainModel(this WorkOrder obj, IncidentWorkOrderDomain domain) { if (obj == null) { obj = new WorkOrder(); } obj.WorkOrderId = domain.WorkOrderId; obj.DateCreated = domain.DateCreated; obj.CreatedBy = domain.CreatedBy; obj.ModifiedBy = domain.ModifiedBy; obj.DateModified = domain.DateModified; obj.TenantId = domain.TenantId; obj.IncidentId = domain.IncidentId; obj.IncidentSettlementId = domain.IncidentSettlementId; return(obj); }
/// <summary> /// Edit workOrder /// </summary> /// <returns><see cref="int"/></returns> public void EditIncidentWorkOrder(IncidentWorkOrderDomain workOrder) { _incidentWorkOrderManipulation.UpdateIncidentWorkOrder(workOrder); }
/// <summary> /// Add new workOrder /// </summary> /// <returns><see cref="int"/></returns> public int AddIncidentWorkOrder(IncidentWorkOrderDomain workOrder) { return(_incidentWorkOrderManipulation.AddIncidentWorkOrder (workOrder)); }