public ActionResult UserAction(Organization item, ICollection <Contact> Contacts, int?id, string actioncase) { switch (actioncase) { case "Save": item.Contacts = ConvertBOTA.ToEntitySet(Contacts); orgservice.UpdateOrganization(item, id.Value); break; case "Delete": orgservice.DeleteOrganization(id.Value); break; } return(RedirectToAction("View", new { id = id })); /* Organization _org = orgservice.GetOrganizationOfCurrentProposal(id.Value); * if (_org != null) * { * item.EntityKey = _org.EntityKey; * * } */ }
public ActionResult UserAction(Organization item, ICollection <Contact> Contacts, int?id, string actioncase, int?h_contactid) { switch (actioncase) { case "Insert": bool status = orgservice.InsertNewOrgContact(id.Value); break; case "Search": IEnumerable <Organization> orgs = orgservice.SearchOrganizationByName(Request.Form["SearchString"]); TempData["searchresult"] = orgs; break; case "Update": orgservice.UpdateOrganizationContact(ConvertBOTA.ToEntitySet(Contacts)); break; case "Delete": if (h_contactid.HasValue) { bool deleted = orgservice.DeleteOrgContact(h_contactid.Value); // orgservice.DeleteOrganization(h_contactid); } break; } return(RedirectToAction("View", new { id = id })); /* Organization _org = orgservice.GetOrganizationOfCurrentProposal(id.Value); * if (_org != null) * { * item.EntityKey = _org.EntityKey; * * } */ }
public ActionResult Test3(Organization o, IEnumerable <Contact> contacts) { o.Contacts = ConvertBOTA.ToEntitySet(contacts); return(View(o)); }
public ActionResult UserAction(Project proj, List <FinArticleCategory> FinArticleCategories, List <FinancialArticle> FinancialArticles, /*Project item,/*List<FinancialArticle> finarticle*//*, ICollection<Contact> Contacts*/ int?id, string actioncase, string FinCatInfo, int?FinCatSel, string NewCatName) { /* * foreach (var item in FinancialArticles) * { * for (int i = 0; i < FinArticleCategories.Count; i++) * { * if (item.FinArticleCatID == FinArticleCategories[i].FinArticleCatID) * { * FinArticleCategories[i].FinancialArticles.Add(item); * } * } * } */ // proj.Budget.FinArticleCategories = ConvertBOTA.ToEntitySet(FinArticleCategories.AsEnumerable()); switch (actioncase) { case "Create Category": projservice.InsertNewCatName(NewCatName); break; case "Add Category": projservice.AddFinArticleCategory(id.Value, FinCatSel.Value); break; case "Search": // IEnumerable<Organization> orgs = orgservice.SearchOrganizationByName(Request.Form["SearchString"]); // TempData["searchresult"] = orgs; break; case "Update": foreach (var cat in FinArticleCategories) { foreach (var article in FinancialArticles) { if (cat.FinArticleCatID == article.FinArticleCatID) { if (!article.DonorInput.HasValue) { article.DonorInput = 0; } if (!article.GranteeInput.HasValue) { article.GranteeInput = 0; } if (article.Info == null) { article.Info = "no info"; } cat.FinancialArticles.Add(article); } } } Budget bud = new Budget(); bud.BudgetID = id.Value; bud.FinArticleCategories = ConvertBOTA.ToEntitySet(FinArticleCategories.AsEnumerable()); projservice.UpdateProjectBudget(bud); break; case "Delete": // Delete organization GeneralInfo. // orgservice.DeleteOrganization(h_contactid); break; } return(RedirectToAction("View", new { id = id })); /* Organization _org = orgservice.GetOrganizationOfCurrentProposal(id.Value); * if (_org != null) * { * item.EntityKey = _org.EntityKey; * * } */ }