public HttpResponseMessage DeleteDocument(int id) { try { CUSTOMER_DOCUMENT document = new CUSTOMER_DOCUMENT { DOCUMENT_ID = id }; db.CUSTOMER_DOCUMENT.Attach(document); db.CUSTOMER_DOCUMENT.Remove(document); db.SaveChanges(); } catch (Exception) { throw; } return(Request.CreateResponse(HttpStatusCode.OK, "success")); }
public HttpResponseMessage CreateDocument(DocumentModel _DocumentModel) { try { CUSTOMER_DOCUMENT def = new CUSTOMER_DOCUMENT(); def.CUSTOMER_CODE = _DocumentModel.CUSTOMER_CODE; def.DATE = _DocumentModel.DATE; def.FILE_NAME = _DocumentModel.FILE_NAME; def.SIZE = _DocumentModel.SIZE; def.TAG = _DocumentModel.TAG; db.CUSTOMER_DOCUMENT.Add(def); db.SaveChanges(); } catch (Exception) { throw; } return(Request.CreateResponse(HttpStatusCode.OK, "success")); }