public int Post([FromBody] ProductBacklogItemDTO pbi) { using (DataAccessLayer modelAccess = new DataAccessLayer()) { try { LogHelper.InfoLog("Attempting to Add new Product backlog item for Project: " + pbi.ProjectID); return(modelAccess.AddProductBacklogItem(new ProductBacklogItem { ProjectID = pbi.ProjectID, Name = pbi.Name, Description = pbi.Description, Data = pbi.Data, SprintID = pbi.SprintID, EffortScore = pbi.EffortScore, Priority = modelAccess.GetNextPBIPriority(pbi.ProjectID), State = pbi.State, Archived = false, DateFinished = null })); } catch (Exception ex) { LogHelper.ErrorLog("Error Adding new Product Backlog Item: " + ex.ToString()); return(0); } } }
public int Put(int id, [FromBody] ProductBacklogItemDTO pbi) { using (DataAccessLayer modelAccess = new DataAccessLayer()) { try { LogHelper.InfoLog("Attempting to update Product Backlog Item with ID: " + pbi.ProductBacklogItemID); modelAccess.UpdateProductBacklogItem(id, new ProductBacklogItem { ProjectID = 0, Name = pbi.Name, Description = pbi.Description, Data = pbi.Data, SprintID = pbi.SprintID, EffortScore = pbi.EffortScore, Priority = pbi.Priority, State = pbi.State, Archived = pbi.Archived, DateFinished = pbi.State == 2 ? (DateTime?)DateTime.Today : null }); return(1); } catch (Exception ex) { LogHelper.ErrorLog("Error Updating Product Backlog Item: " + ex.ToString()); return(0); } } }