// GET: Admin/CompanyCategories/Edit/5 public async Task <IActionResult> Edit(int?id) { if (id == null) { return(NotFound()); } CompanyCategory item = await _context.CompanyCategories.FindAsync(id); CompanyCategoryModel model = new CompanyCategoryModel { Id = item.Id, Name = item.Name, CreateDate = item.CreateDate, EndDate = item.EndDate, StartDate = item.StartDate, ParentId = item.ParentId, Published = item.Published }; PrepareCompanyList(model.AvailableCategories, true, "Kategori Seç"); if (model.Id == 0) { WarningNotification($"{id} , Kayıt Bulunamadı"); } return(View(model)); }
public async Task <IActionResult> Create(CompanyCategoryModel model) { if (ModelState.IsValid) { CompanyCategory companyCategory = new CompanyCategory { Name = model.Name, ParentId = model.ParentId, CreateDate = DateTime.Now, UpdateDate = DateTime.Now, StartDate = model.StartDate, EndDate = model.EndDate, Published = model.Published }; string seName = _urlRecordService.ValidateSeName(companyCategory, model.SeName, model.Name, true); _urlRecordService.SaveSlug(companyCategory, seName); _context.Add(companyCategory); _eventPublisher.EntityInserted(companyCategory); try { await _context.SaveChangesAsync(); SuccessNotification("Kategori Oluşturuldu"); } catch (Exception e) { ErrorNotification($"Hata oluştu {e.Message}"); return(View(model)); } return(RedirectToAction(nameof(Index))); } return(View(model)); }
// GET: Admin/CompanyCategories/Details/5 public async Task <IActionResult> Details(int?id) { if (id == null) { return(NotFound()); } CompanyCategory item = await _context.CompanyCategories .FirstOrDefaultAsync(m => m.Id == id); CompanyCategoryModel companyCategory = new CompanyCategoryModel { Id = item.Id, Name = item.Name, CreateDate = item.CreateDate, EndDate = item.EndDate, StartDate = item.StartDate, ParentId = item.ParentId, Published = item.Published }; PrepareCompanyList(companyCategory.AvailableCategories, true, "Kategori Seç"); if (companyCategory.Id == 0) { ErrorNotification($"Kayıt Bulunamadı,{id}"); } return(View(companyCategory)); }
/// <summary> /// DeleteCategory /// </summary> /// <param name="companyCategory"></param> public void DeleteCategory(CompanyCategory companyCategory) { if (companyCategory == null) { throw new ArgumentNullException(nameof(companyCategory)); } _companyCategoryRepository.Delete(companyCategory); }
public ActionResult DeleteConfirmed(int id) { CompanyCategory companyCategory = db.CompanyCategories.Find(id); db.CompanyCategories.Remove(companyCategory); db.SaveChanges(); return(RedirectToAction("Index")); }
public void UpdateCompanyCategory(CompanyCategory companyCategory) { using (var context = new DataContext()) { context.Entry(companyCategory).State = EntityState.Modified; context.SaveChanges(); } }
/// <summary> /// InsertCategory /// </summary> /// <param name="companyCategory"></param> public void InsertCategory(CompanyCategory companyCategory) { if (companyCategory == null) { throw new ArgumentNullException(nameof(companyCategory)); } _companyCategoryRepository.Insert(companyCategory); }
public bool Delete(CompanyCategory companyCategory) { db.CompanyCategories.Remove(companyCategory); if (Convert.ToBoolean(db.SaveChanges())) { return(true); } return(false); }
public CompanyCategory InsertCompanyCategory(CompanyCategory companyCategory) { using (var context = new DataContext()) { CompanyCategory newCompanyCategory = context.CompanyCategories.Add(companyCategory); context.SaveChanges(); return(newCompanyCategory); } }
public ActionResult Edit([Bind(Include = "id,name,categoryDayCost,categoryOTCost,description")] CompanyCategory companyCategory) { if (ModelState.IsValid) { db.Entry(companyCategory).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(companyCategory)); }
public bool update(CompanyCategory companyCategory) { db.CompanyCategories.Attach(companyCategory); db.Entry(companyCategory).State = EntityState.Modified; if (Convert.ToBoolean(db.SaveChanges())) { return(true); } return(false); }
public ActionResult Create([Bind(Include = "id,name,categoryDayCost,categoryOTCost,description")] CompanyCategory companyCategory) { if (ModelState.IsValid) { db.CompanyCategories.Add(companyCategory); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(companyCategory)); }
public async Task <IActionResult> DeleteConfirmed(int id) { CompanyCategory companyCategory = await _context.CompanyCategories.FindAsync(id); _context.CompanyCategories.Remove(companyCategory); await _context.SaveChangesAsync(); SuccessNotification("Kayıt Silindi"); _eventPublisher.EntityDeleted(companyCategory); return(RedirectToAction(nameof(Index))); }
public void RemoveCompanyCategory(int id) { using (var context = new DataContext()) { CompanyCategory companyCategory = context.CompanyCategories.FirstOrDefault(c => c.ID == id); if (companyCategory != null) { context.CompanyCategories.Remove(companyCategory); context.SaveChanges(); } } }
public void MemberAccountInformation() { Member member = new Member(); using (TheFacade facade = new TheFacade()) { member = facade.MemberFacade.GetMemberById(MemberID); } if (member.ID > 0) { txtCompanyName.Text = member.Name; txtCompanyNameBangla.Text = member.NameBangla; txtCompanyAddress.Text = member.Address; txtCompanyAddressBangla.Text = member.AddressBangla; txtEmail.Text = member.Email; txtPhone.Text = member.Phone; txtFax.Text = member.Fax; txtMobile.Text = member.Mobile; txtIndustryLocation.Text = member.IndustryLocation; txtCompanyEstablishmentDate.Text = member.CompanyEstablishmentYear.ToString(); txtIndustryFoundationDate.Text = member.IndustryFoundationYear.ToString(); txtTypeOfBusiness.Text = member.TypeOfBusiness.ToString(); using (TheFacade facade = new TheFacade()) { CompanyType companyType = facade.CommonFacade.GetCompanyTypeById(member.CompanyTypeID); if (companyType != null) { txtCompanyTypeID.Text = companyType.Name; } CompanyCategory companyCategory = facade.CommonFacade.GetCompanyCategotyById(member.CompanyCategoryID); if (companyType != null) { txtCompanyCategoryID.Text = companyCategory.Name; } } //txtCompanyCategoryID.Text = member.CompanyCategoryID.ToString(); //txtCompanyCategoryID.Text = member.CompanyCategory.Name.ToString(); txtManufacturedProducts.Text = member.ManufacturedProducts; txtImportedProducts.Text = member.ImportedProducts; txtExportedProducts.Text = member.ExportedProducts; txtNameOfTheAssociations.Text = member.NameOfTheAssociations; } else { Response.Redirect("/Login/Logout.aspx"); } }
// GET: CompanyCategories/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CompanyCategory companyCategory = db.CompanyCategories.Find(id); if (companyCategory == null) { return(HttpNotFound()); } return(View(companyCategory)); }
public IActionResult Post([FromBody] CompanyCategory value) { if (value.Id == 0) { _companyCategoryRepository.InsertCompanyCategory(value); } else { _companyCategoryRepository.UpdateCompanyCategory(value); } _companyCategoryRepository.Save(); return(Ok()); }
// GET: CompanyCategories/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CompanyCategory companyCategory = db.CompanyCategories.Find(id); db.CompanyCategories.Remove(companyCategory); db.SaveChanges(); if (companyCategory == null) { return(HttpNotFound()); } return(RedirectToAction("Index")); }
// PUT api/<controller>/5 public IHttpActionResult Put(CompanyCategory companyCategory) { IHttpActionResult result = null; CompanyCategoryService service = new CompanyCategoryService(); if (service.GetCompanyCategory(companyCategory.ID) != null) { service.UpdateCompanyCategory(companyCategory); result = Ok(companyCategory); } else { result = NotFound(); } return(result); }
// GET: Admin/CompanyCategories/Delete/5 public async Task <IActionResult> Delete(int?id) { if (id == null) { WarningNotification($"Kayıt Bulunamadı, {id.ToString()} "); } CompanyCategory companyCategory = await _context.CompanyCategories .FirstOrDefaultAsync(m => m.Id == id); if (companyCategory == null) { WarningNotification($"{id} , Kayıt Bulunamadı"); } return(View(companyCategory)); }
// POST api/<controller> public IHttpActionResult Post(CompanyCategory companyCategory) { IHttpActionResult result = null; CompanyCategoryService service = new CompanyCategoryService(); CompanyCategory newCompanyCategory = service.InsertCompanyCategory(companyCategory); if (newCompanyCategory != null) { result = Created <CompanyCategory>(Request.RequestUri + newCompanyCategory.ID.ToString(), newCompanyCategory); } else { result = NotFound(); } return(result); }
public ActionResult SetCompanyCategories() { var companies = _db.Companies.ToList(); foreach (var comp in companies) { if (comp.CategoryId1 != null && comp.CategoryId1 > 0) { CompanyCategory cCategory = new CompanyCategory(); cCategory.CompanyId = comp.CompanyId; cCategory.CategoryId = Convert.ToInt32(comp.CategoryId1); _db.CompanyCategories.Add(cCategory); } } _db.SaveChanges(); return(View()); }
// GET api/<controller>/5 public IHttpActionResult Get(int id) { IHttpActionResult result = null; CompanyCategoryService service = new CompanyCategoryService(); CompanyCategory companyCategory = service.GetCompanyCategory(id); if (companyCategory != null) { result = Ok(companyCategory); } else { result = NotFound(); } return(result); }
public async Task <IActionResult> Edit(CompanyCategoryModel model, int id) { CompanyCategory updateItem = _context.CompanyCategories.Find(model.Id); if (updateItem.Id == 0) { return(NotFound()); } if (ModelState.IsValid) { try { updateItem.Name = model.Name; updateItem.ParentId = model.ParentId; updateItem.UpdateDate = DateTime.Now; updateItem.StartDate = model.StartDate; updateItem.EndDate = model.EndDate; updateItem.Published = model.Published; _context.Update(updateItem); await _context.SaveChangesAsync(); string seName = _urlRecordService.ValidateSeName(updateItem, model.SeName, model.Name, true); _urlRecordService.SaveSlug(updateItem, seName); _eventPublisher.EntityUpdated(updateItem); SuccessNotification("Kayıt Güncelendi"); } catch (DbUpdateConcurrencyException) { if (!CompanyCategoryExists(updateItem.Id)) { WarningNotification($"{id} , Kayıt Bulunamadı"); } else { throw; } } return(RedirectToAction("Index")); } return(View(model)); }
// DELETE api/<controller>/5 public IHttpActionResult Delete(int id) { IHttpActionResult result = null; CompanyCategoryService service = new CompanyCategoryService(); CompanyCategory companyCategory = service.GetCompanyCategory(id); if (companyCategory != null) { service.RemoveCompanyCategory(id); result = Ok(true); } else { result = NotFound(); } return(result); }
public void InsertCompanyCategory(CompanyCategory CompanyCategory) { context.CompanyCategories.Add(CompanyCategory); }
public async Task <IActionResult> GetByCategory(CompanyCategory category) { var companies = await _userCompanyService.GetByCategoryAsync(category); return(Ok(_mapper.Map <IEnumerable <Company>, IEnumerable <CompanyDto> >(companies))); }
public void DeleteCompanyCategory(int CompanyCategoryID) { CompanyCategory CompanyCategory = context.CompanyCategories.Find(CompanyCategoryID); context.CompanyCategories.Remove(CompanyCategory); }
public CompanyListModel PrePareCompanyListModel(CompanyCategory category) { throw new System.NotImplementedException(); }
public void UpdateCompanyCategory(CompanyCategory CompanyCategory) { context.Entry(CompanyCategory).State = EntityState.Modified; }
public void SetMemberOfCategory(CompanyCategory memberOfCategory) { SetToWhat(memberOfCategory); }