public IActionResult Create(string ctName, string ctInfo, string ctLocation, ComponentTypeStatus ctStatus, string ctDatasheet, string ctImageUrl, string ctManufacturer, string ctWikiLink, string ctAdminComment) { if (!string.IsNullOrEmpty(ctName)) { var coType = new ComponentType(); coType.ComponentName = ctName; coType.ComponentInfo = ctInfo; coType.Location = ctLocation; coType.Status = ctStatus; coType.Datasheet = ctDatasheet; coType.ImageUrl = ctImageUrl; coType.Manufacturer = ctManufacturer; coType.WikiLink = ctWikiLink; coType.AdminComment = ctAdminComment; context.ComponentTypes.Add(coType); context.SaveChanges(true); return(RedirectToAction("Show", new { id = coType.ComponentTypeId })); } else { ViewData["error"] = "Please input a correct name."; return(View()); } }
public IActionResult Create(long componentTypeId, int componentNumber, string serialNo, ComponentStatus status, string adminComment, string userComment) { var component = new Component(); component.ComponentTypeId = componentTypeId; component.ComponentNumber = componentNumber; component.SerialNo = serialNo; component.Status = status; component.AdminComment = adminComment; component.UserComment = userComment; context.Components.Add(component); context.SaveChanges(); return(RedirectToAction("Show", "ComponentType", new { id = component.ComponentTypeId })); }
public IActionResult Create(string categoryName) { if (!string.IsNullOrEmpty(categoryName)) { var cat = new Category(); cat.Name = categoryName; context.Categories.Add(cat); context.SaveChanges(true); return(RedirectToAction("Show", new { id = cat.CategoryId })); } else { ViewData["error"] = "Please input a correct name you noob."; return(View()); } }