public string DeleteFile(int id) { string rpta; file_types file = new file_types(); try { using (var ctx = new transshipEntities()) { file = ctx.file_types.FirstOrDefault(x => x.file_typeId == id); if (file != null) { ctx.Entry(file).State = EntityState.Deleted; ctx.SaveChanges(); rpta = "ok"; } else { rpta = "fail"; } } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } return(rpta); }
public HttpResponseMessage Put(file_types model) { try { BOFile_types file = new BOFile_types(); file_types fileType; fileType = file.UpdateFile(model); return(Request.CreateResponse(HttpStatusCode.OK, fileType)); } catch (Exception e) { ErrorMessage message = new ErrorMessage("2.1", "Exception to update file - " + e.GetBaseException().Message, e.ToString()); return(Request.CreateResponse(HttpStatusCode.InternalServerError, message)); } }
public file_types SaveFiles(file_types model) { var file = new file_types(); try { using (var ctx = new transshipEntities()) { file = ctx.file_types.Add(model); ctx.SaveChanges(); return(file); } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public file_types UpdateFiles(file_types model) { file_types file = new file_types(); file = model; try { using (var ctx = new transshipEntities()) { ctx.Entry(file).State = EntityState.Modified; ctx.SaveChanges(); return(file); } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public file_types UpdateFile(file_types countries) { return(file.UpdateFiles(countries)); }
public file_types SaveFile(file_types files) { return(file.SaveFiles(files)); }