public ActionResult Create() { var model = SqueezeJson(); _productions.Insert(model); return(VidpubJSON(model)); }
public OperationResult <Contact> AddContact(Contact contact) { var result = new OperationResult <Contact>(); table.Insert(contact.ForInsert()); return(result); }
public dynamic AddInvoice(dynamic invoice) { var invoices = new DynamicModel("invoicesDB", "invoice", "id"); var addedInvoice = invoices.Insert(new { nroinvoice = invoice.nroinvoice, company = invoice.company, customer = invoice.customer }); return(addedInvoice); }
public dynamic AddDetails(dynamic invoiceDetail) { var invoicesDetail = new DynamicModel("invoicesDB", "invoiceDetail", "id"); var addedInvoice = invoicesDetail.Insert(new { idInvoice = invoiceDetail.idInvoice, productname = invoiceDetail.productname, quantity = invoiceDetail.quantity, unitprice = invoiceDetail.unitprice, subtotal = invoiceDetail.subtotal }); return(addedInvoice); }
public ActionResult Insert(dynamic viewModel, FormCollection formCollection) { var model = tbl.CreateFrom(formCollection); try { tbl.Insert(model); } catch (Exception x) { TempData["Error"] = "There was a problem adding this record"; } return(null); }
public static dynamic Process(DataProcessRequest request) { dynamic result = null; var tbl = new DynamicModel(ConnectionString, tableName: request.EntityType.Name, primaryKeyField: "Id"); switch (request.Type) { case RequestType.GET: if (request.Object != null) { throw new NotImplementedException(); //result = tbl. } else { result = tbl.All(); } break; case RequestType.POST: // Id is not allowed when doing an insert as this is the auto generated key as IDENTITY(1,1) IDictionary <string, object> map = ObjectExtensions.ToDictionary(request.Object); map.Remove("Id"); result = tbl.Insert(map); break; case RequestType.UPDATE: result = tbl.Update(request.Object); break; case RequestType.PUT: throw new NotImplementedException(); break; case RequestType.DELETE: throw new NotImplementedException(); break; default: break; } return(result); }
/// <summary> /// Save record with information about entity change /// </summary> /// <param name="entityName">Entity name</param> /// <param name="entityKey">Entity key of changed record</param> /// <param name="changeType">Change type</param> /// <param name="description">Description for update change type</param> private void AddEntityChange(string entityName, string entityKey, EntityChangeType changeType, string description = null) { if (AdminInitialise.ChangeEntity == null) { return; } var table = new DynamicModel(AdminInitialise.ConnectionString, tableName: AdminInitialise.ChangeEntity.TableName, primaryKeyField: "EntityChangeId"); dynamic changeRecord = new ExpandoObject(); changeRecord.EntityName = entityName; changeRecord.EntityKey = entityKey; changeRecord.ChangeType = changeType; changeRecord.Description = description; changeRecord.ChangedOn = DateTime.UtcNow; changeRecord.ChangedBy = HttpContext.Current.User.Identity.Name; table.Insert(changeRecord); }