Example #1
0
        public OperationDetails AddAttributeGroup(AttributeGroupDTO dto)
        {
            AttributeGroup group = new AttributeGroup();

            group.SortOrder    = dto.SortOrder;
            group.DateAdded    = DateTime.Now;
            group.DateModefied = DateTime.Now;
            group = _unitOfWork.AttributeGroupRepsitory.Insert(group);

            AttributeGroupDescription arabicDescription  = new AttributeGroupDescription();
            AttributeGroupDescription englishDescription = new AttributeGroupDescription();

            arabicDescription.GroupId      = group.Id;
            arabicDescription.Text         = dto.ArabicName;
            arabicDescription.LanguageId   = (long)Langs.Arabic;
            arabicDescription.DateAdded    = DateTime.Now;
            arabicDescription.DateModefied = DateTime.Now;

            englishDescription.GroupId      = group.Id;
            englishDescription.Text         = dto.EnglishName;
            englishDescription.LanguageId   = (long)Langs.English;
            englishDescription.DateAdded    = DateTime.Now;
            englishDescription.DateModefied = DateTime.Now;
            _unitOfWork.AttributeGroupDescriptionRepsitory.Insert(arabicDescription);
            _unitOfWork.AttributeGroupDescriptionRepsitory.Insert(englishDescription);

            _unitOfWork.Save();
            return(new OperationDetails(true, "تمت إضافة مجموعة الواصفات بنجاح", ""));
        }
Example #2
0
        public OperationDetails EditAttributeGroup(AttributeGroupDTO dto)
        {
            AttributeGroup group = _unitOfWork.AttributeGroupRepsitory.Get(c => c.Id == dto.Id).FirstOrDefault();

            group.SortOrder    = dto.SortOrder;
            group.DateAdded    = DateTime.Now;
            group.DateModefied = DateTime.Now;
            _unitOfWork.AttributeGroupRepsitory.Update(group);

            long arabicLang  = (long)Langs.Arabic;
            long englishLang = (long)Langs.English;

            AttributeGroupDescription arabicDescription = _unitOfWork.AttributeGroupDescriptionRepsitory.Get(c => c.GroupId == dto.Id && c.LanguageId == arabicLang).FirstOrDefault();

            AttributeGroupDescription englishDescription = _unitOfWork.AttributeGroupDescriptionRepsitory.Get(c => c.GroupId == dto.Id && c.LanguageId == englishLang).FirstOrDefault();


            arabicDescription.Text         = dto.ArabicName;
            arabicDescription.LanguageId   = (long)Langs.Arabic;
            arabicDescription.DateModefied = DateTime.Now;


            englishDescription.Text         = dto.EnglishName;
            englishDescription.DateModefied = DateTime.Now;

            _unitOfWork.AttributeGroupDescriptionRepsitory.Update(arabicDescription);
            _unitOfWork.AttributeGroupDescriptionRepsitory.Update(englishDescription);

            _unitOfWork.Save();
            return(new OperationDetails(true, "تمت تعديل مجموعة الواصفات بنجاح", ""));
        }