public override T Create <T>(T toCreate) { T result = SourceRepository.Create <T>(toCreate); CreateInWriteRepos(toCreate); return(result); }
public override object Create(object toCreate) { object result = SourceRepository.Create(toCreate); CreateInWriteRepos(toCreate); return(result); }
private void InsertEntities(NewWorkData datas) { workRepository.Create(datas.Works); if (!sourceRepository.Exists(datas.ProjectID)) { sourceRepository.Create(datas.Sources); } targetRepository.Create(datas.Targets); }
public string Edit(FormDataCollection form) { string retVal = string.Empty; string operation = form.Get("oper"); int id = ConvertHelper.ToInt32(form.Get("SourceId")); SourceInfo info = null; if (!string.IsNullOrEmpty(operation)) { switch (operation) { case "edit": info = SourceRepository.GetInfo(id); if (info != null) { info.Name = form.Get("Name"); info.Code = form.Get("Code"); info.Description = form.Get("Description"); info.ChangedBy = UserRepository.GetCurrentUserInfo().UserID; SourceRepository.Update(info); } break; case "add": info = new SourceInfo { Name = form.Get("Name"), Code = form.Get("Code"), Description = form.Get("Description"), CreatedBy = UserRepository.GetCurrentUserInfo().UserID }; SourceRepository.Create(info); break; case "del": SourceRepository.Delete(id, UserRepository.GetCurrentUserInfo().UserID); break; default: break; } } return(retVal); }
public ActionResult Create(FormCollection collection) { try { // TODO: Add insert logic here try { //fill business object var info = new SourceInfo(); /* * * * info.SourceId = collection["SourceId"]; * * * * info.Name = collection["Name"]; * * * * * info.Code = collection["Code"]; * * * * * info.Description = collection["Description"]; * * * * * * * * * * * info.CreatedBy = collection["CreatedBy"]; * * * * * * * * * * info.ChangedBy = collection["ChangedBy"]; * * * * * * * * */ SourceRepository.Create(info); } catch (Exception ex) { } return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(Source sr) { _rep.Create(sr); return(RedirectToAction("Index")); }