Ejemplo n.º 1
0
        internal object RentalGroupsItem(RentalGroupsItem aGFT)
        {
            //New
            if (aGFT.FKCategory_Id <= 0)
            {
                return new { RequestType = RequestTypeEnumVM.Warning, Message = Token.FiledIsRequired + " : " + Token.Category + " " + Token.Or + " " + Token.Category, Title = Token.Warning }
            }
            ;

            //just add FKCategory_Id or FKCategory_Id
            if (aGFT.FKSubCategory_Id.HasValue)
            {
                var SubCategory = db.Categories.Find(aGFT.FKCategory_Id);

                if (db.RentalGroupsItems.Any(x => x.FKGroupsItem_Id == aGFT.FKGroupsItem_Id && x.FKSubCategory_Id == aGFT.FKSubCategory_Id))
                {
                    var Dupl = db.RentalGroupsItems.Where(c => c.FKSubCategory_Id == aGFT.FKSubCategory_Id && c.FKGroupsItem_Id == aGFT.FKGroupsItem_Id).Single();
                    return(new { RequestType = RequestTypeEnumVM.Warning, Message = Token.CanNotDuplicateRow + " : " + Dupl.SubCategory.SubCategoryName + " " + Token.With + " : " + Dupl.GroupsItem.GroupItemName, Title = Token.Warning });
                }
            }
            else
            {
                var Category = db.Categories.Find(aGFT.FKCategory_Id);
                if (db.RentalGroupsItems.Any(x => x.FKGroupsItem_Id == aGFT.FKGroupsItem_Id && x.FKCategory_Id == aGFT.FKCategory_Id))
                {
                    var Dupl = db.RentalGroupsItems.Where(c => c.FKCategory_Id == aGFT.FKCategory_Id && c.FKGroupsItem_Id == aGFT.FKGroupsItem_Id).Single();
                    return(new { RequestType = RequestTypeEnumVM.Warning, Message = Token.CanNotDuplicateRow + " : " + Dupl.Category.CategoryName + " " + Token.With + " : " + Dupl.GroupsItem.GroupItemName, Title = Token.Warning });
                }
            }

            var GroupsField = db.GroupsItems.Find(aGFT.FKGroupsItem_Id);

            db.RentalGroupsItems.Add(aGFT);
            return(null);
        }
Ejemplo n.º 2
0
        internal object RentalGroupsItem(RentalGroupsItem aGFT)
        {
            var GroupsFieldRemove = db.RentalGroupsItems.Where(x => x.Id == aGFT.Id).Single();

            //Delete
            db.RentalGroupsItems.Remove(GroupsFieldRemove);
            return(null);
        }
Ejemplo n.º 3
0
 internal object RentalGroupsItem(RentalGroupsItem adsGroupsItem)
 {
     throw new NotImplementedException();
 }