public SubCategory(SubCategoryData subCategoryData) { Id = subCategoryData.Id; Parent = subCategoryData.Parent; Titel = subCategoryData.Titel; ParentCategory = new Category(subCategoryData.CategoryData); //ServiceData = subCategoryData.ServiceData; }
public bool DeleteSubCategory(int id) { using (ServiceDBModel db = new ServiceDBModel()) { try { SubCategoryData subCategoryDataToRemove = db.SubCategoryData.Find(id); db.SubCategoryData.Remove(subCategoryDataToRemove); db.SaveChanges(); return(true); } catch (Exception) { Log.Error("Error"); return(false); } } }
public bool EditSubCategory(int id, int parentId, string title) { using (ServiceDBModel db = new ServiceDBModel()) { try { SubCategoryData subCategoryData = db.SubCategoryData.Find(id); subCategoryData.Parent = parentId; subCategoryData.Titel = title; db.SaveChanges(); return(true); } catch (Exception) { Log.Error("Error"); return(false); } } }
public ServiceData(Service service) { Id = service.Id; Type = service.Type; CreatorID = service.CreatorID; ServiceStatusID = service.ServiceStatusID; Picture = service.Picture; CreatedTime = service.CreatedTime; Title = service.Title; Description = service.Description; Price = service.Price; StartDate = service.StartDate; EndDate = service.EndDate; TimeNeeded = service.TimeNeeded; Modified = service.Modified; ServiceTypeData = new ServiceTypeData(service.ServiceType); SubCategoryData = new SubCategoryData(service.SubCategory); ServiceStatusData = new ServiceStatusData(service.ServiceStatus); }