public IHttpActionResult DeleteCCIRPIR(string id) { CCIRPIR cCIRs = db.CCIRPIRs.Find(id); if (cCIRs == null) { return(NotFound()); } db.CCIRPIRs.Remove(cCIRs); db.SaveChanges(); cCIRs.DeleteFiles(cCIRs.GetType().GetProperties().Where(p => properties.Contains(p.Name)).ToArray(), "CCIRPIR"); return(Ok(cCIRs)); }
public IHttpActionResult GetCCIRPIRData(string id) { CCIRPIR cCIRs = db.CCIRPIRs.Find(id); if (cCIRs == null) { return(NotFound()); } cCIRs.AddUrl(cCIRs.GetType().GetProperties().Where(p => properties.Contains(p.Name)).ToArray(), this.Request); //object uploadUrl; //Request.Properties.TryGetValue("uploadUrl", out uploadUrl); //cCIRs.EffectiveAreaKML = uploadUrl + cCIRs.EffectiveAreaKML; return(Ok(cCIRs)); }
public async Task <IHttpActionResult> PutCCIRPIR(string id) { CCIRPIR cCIRPIR = await UpdateDataWithFile(); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } // TODO It can make api slow so commenting it. Will use if needed //string message = string.Empty; //if (!IsValidData(cCIRs, out message)) //{ // return BadRequest(message); //} if (!string.Equals(cCIRPIR.CCIRPIRId, id.ToString(), StringComparison.OrdinalIgnoreCase)) { return(BadRequest()); } cCIRPIR.RemoveUrl(cCIRPIR.GetType().GetProperties().Where(p => properties.Contains(p.Name)).ToArray(), this.Request); cCIRPIR.LastUpdate = DateTime.Now; db.Entry(cCIRPIR).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CCIRPIRsExists(id.ToString())) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }