// POST: api/IssueStatus public HttpStatusCodeResult Post([FromBody] IssueStatusView value) { if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors).Select(e => e.Exception); return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, string.Join(" | ", errors))); } IssueStatusLog log = new IssueStatusLog(); log.IssueID = value.IssueID; log.IssueStatusID = dal.GetEntities <IssueStatu>(c => c.name == value.IssueStatusName).FirstOrDefault().id; log.LogAt = DateTime.UtcNow; dal.AddOrUpdate <IssueStatusLog>(log, c => c.IssueID == value.IssueID, Basic.ToDictionary <IssueStatusLog>(log)); return(new HttpStatusCodeResult(HttpStatusCode.OK)); }
// POST api/<controller> public HttpStatusCodeResult Post([FromBody] string value) { if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors).Select(e => e.Exception); return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, string.Join(" | ", errors))); } List <Platform> platforms = HttpHelper.GetPlatforms(); foreach (var item in platforms) { dal.AddOrUpdate <Platform>(item, c => c.Name == item.Name, Basic.ToDictionary <Platform>(item)); } return(new HttpStatusCodeResult(HttpStatusCode.OK)); }
// POST api/<controller> //public HttpStatusCodeResult Post([FromBody]CodeOwnership value) //{ // if (!ModelState.IsValid) // { // var errors = ModelState.Values.SelectMany(v => v.Errors).Select(e => e.Exception); // return new HttpStatusCodeResult(HttpStatusCode.BadRequest, string.Join(" | ", errors)); // } // value.LogAt = DateTime.UtcNow; // dal.AddOrUpdate<CodeOwnership>(value, c => c.FkId == value.FkId && c.Type == value.Type, Basic.ToDictionary<CodeOwnership>(value)); // return new HttpStatusCodeResult(HttpStatusCode.OK); //} public CodeOwnership Post([FromBody] CodeOwnership value) { value.LogAt = DateTime.UtcNow; dal.AddOrUpdate <CodeOwnership>(value, c => c.FkId == value.FkId && c.Type == value.Type, Basic.ToDictionary <CodeOwnership>(value)); return(value); }