public async Task <ActionResult> Create([Bind(Include = "Id,Name,Description,Extension,FilePath,FileSize,Year,Month,ContentType,CreateDate,CreatedBy,UpdateDate,UpdateBy")] Media media) { if (ModelState.IsValid) { media.CreateDate = DateTime.Now; media.CreatedBy = User.Identity.Name; media.UpdateDate = DateTime.Now; media.UpdateBy = User.Identity.Name; //Upload işlemi if (!string.IsNullOrEmpty(media.FilePath)) { FileInfo fileInfo = new FileInfo(Server.MapPath("~" + media.FilePath)); media.FileSize = ((float)fileInfo.Length) / ((float)1024); media.Extension = fileInfo.Extension; media.ContentType = fileInfo.Extension; } db.Medias.Add(media); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(media)); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Email,EmailConfirmed,PhoneNumber,PhoneNumberConfirmed,TwoFactorEnabled,LockoutEndDateUtc,LockoutEnabled,AccessFailedCount,UserName")] ApplicationUser applicationUser) { if (ModelState.IsValid) { db.Entry(applicationUser).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(applicationUser)); }
public async Task <ActionResult> Create([Bind(Include = "Id,Name,CreateDate,CreatedBy,UpdateDate,UpdateBy")] Side side) { if (ModelState.IsValid) { side.CreateDate = DateTime.Now; side.CreatedBy = User.Identity.Name; side.UpdateDate = DateTime.Now; side.UpdateBy = User.Identity.Name; db.Sides.Add(side); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(side)); }
public async Task <ActionResult> Create([Bind(Include = "Id,Name,CreateDate,CreatedBy,UpdateDate,UpdateBy")] Department department) { if (ModelState.IsValid) { department.CreatedBy = User.Identity.Name; department.CreateDate = DateTime.Now; department.UpdateBy = User.Identity.Name; department.UpdateDate = DateTime.Now; db.Departments.Add(department); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(department)); }
public async Task <ActionResult> Create([Bind(Include = "Id,Name,Email,Phone,Fax,Website,Address,CreateDate,CreatedBy,UpdateDate,UpdateBy")] Customer customer) { if (ModelState.IsValid) { customer.CreatedBy = User.Identity.Name; customer.CreateDate = DateTime.Now; customer.UpdateBy = User.Identity.Name; customer.UpdateDate = DateTime.Now; db.Customers.Add(customer); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(customer)); }
public async Task <ActionResult> Create([Bind(Include = "Id,Name,CreateDate,CreatedBy,UpdateDate,UpdateBy")] Category category) { if (ModelState.IsValid) { category.CreateDate = DateTime.Now; category.CreatedBy = User.Identity.Name; category.UpdateDate = DateTime.Now; category.UpdateBy = User.Identity.Name; db.Categories.Add(category); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(category)); }