public async Task <IActionResult> NewsCategoryCreateAdmin(NCategoryModel model, IFormFile file) { var entity = new NCategory() { Tittle = model.Tittle, Url = model.Url, }; if (file != null) { var extention = Path.GetExtension(file.FileName); var randomName = string.Format($"{Guid.NewGuid()}{extention}"); entity.Image = randomName; var path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot\\img", randomName); using (var stream = new FileStream(path, FileMode.Create)) { await file.CopyToAsync(stream); } } _nCategoryServices.Create(entity); var name = entity.Tittle; TempData.Put("message", new AlertMessage() { Title = "Kategori Ekleme", Message = $"{name} Kategorisi Başarıyla Eklendi", AlertType = "success" }); return(RedirectToAction("NewsCategoryListAdmin")); }
public object GetNewsCategoryDetails(NCategory N) { string k = N.Url.ToString(); using (var context = new HalicContext()) { var newses = context.News .Include(i => i.newsHCategories) .ThenInclude(i => i.NCategories) .Where(i => i.newsHCategories.Any(a => a.NCategories.Url == k)).Include(i => i.newsHCategories).ThenInclude(i => i.News); return(newses.OrderByDescending(i => i.NewsId).Take(4).ToList()); } }
protected override void InitSchedule(NSchedule schedule) { // Rename the first predefined category schedule.Categories[0].Name = NLoc.Get("Renamed Category"); // Create and add some custom categories NCategory category1 = new NCategory(NLoc.Get("Custom Category 1"), NColor.Khaki); schedule.Categories.Add(category1); NCategory category2 = new NCategory(NLoc.Get("Custom Category 2"), new NHatchFill(ENHatchStyle.DiagonalBrick, NColor.Red, NColor.Orange)); schedule.Categories.Add(category2); // Remove the second category schedule.Categories.RemoveAt(1); // Remove the category called "Green" NCategory categoryToRemove = schedule.Categories.FindByName(NLoc.Get("Green")); if (categoryToRemove != null) { schedule.Categories.Remove(categoryToRemove); } // Create and add some appointments DateTime start = DateTime.Now; NAppointment appointment1 = new NAppointment("Meeting 1", start, start.AddHours(2)); appointment1.Category = category1.Name; schedule.Appointments.Add(appointment1); NAppointment appointment2 = new NAppointment("Meeting 2", appointment1.End.AddHours(0.5), appointment1.End.AddHours(2.5)); appointment2.Category = category2.Name; schedule.Appointments.Add(appointment2); // Scroll the schedule to the start of the first appointment schedule.ScrollToTime(start.TimeOfDay); }
public object GetNewsCategoryDetails(NCategory N) { return(_newsRepository.GetNewsCategoryDetails(N)); }
public void Update(NCategory Entity) { _NCategoryRepository.Update(Entity); }
public void Delete(NCategory Entity) { _NCategoryRepository.Delete(Entity); }
public void Create(NCategory Entity) { _NCategoryRepository.Create(Entity); }