Exemplo n.º 1
0
        public void DeleteTag(int TagId, string userId)
        {
            TBL_TAG comp = TagRepository.GetById(TagId);

            comp.UPDATE_USER = userId;
            comp.IS_DELETED  = true;
            TagRepository.Update(comp);
        }
Exemplo n.º 2
0
        public ActionResult TagGridUpdateTemp(MVCxGridViewBatchUpdateValues <TagDTO, int> updateValues)
        {
            string curUserId = User.Identity.GetUserId();

            foreach (TagDTO tagDto in updateValues.Insert)
            {
                if (updateValues.IsValid(tagDto))
                {
                    TBL_TAG tag = new TBL_TAG();
                    tag = Mapper.Map <TagDTO, TBL_TAG>(tagDto);
                    tag.CREATED_DATE = DateTime.Now;
                    if (tag.IS_DIGITAL == null)
                    {
                        tag.IS_DIGITAL = false;
                    }
                    DB.Tags.Add(tag);
                }
            }

            foreach (TagDTO tagDto in updateValues.Update)
            {
                if (updateValues.IsValid(tagDto))
                {
                    TBL_TAG ent = DB.Tags.FirstOrDefault(x => x.ID == tagDto.ID);

                    //ent = Mapper.Map<TagDTO, TBL_TAG>(tagDto);
                    ent.NAME         = tagDto.NAME;
                    ent.UPDATED_DATE = DateTime.Now;
                    ent.UPDATE_USER  = curUserId;
                    ent.IS_DIGITAL   = tagDto.IS_DIGITAL;
                    ent.IS_INV_TAG   = tagDto.IS_INV_TAG.Value;
                    ent.IS_STRING    = tagDto.IS_STRING;

                    DB.Entry(ent).State = EntityState.Modified;
                    DB.SaveChanges();

                    //DB.Tags.Attach(ent);
                }
            }

            foreach (var tagIg in updateValues.DeleteKeys)
            {
                TBL_TAG ent = DB.Tags.FirstOrDefault(x => x.ID == tagIg);
                ent.IS_DELETED = true;
            }
            DB.SaveChanges();
            return(PartialView("GridTagPartial"));
        }
Exemplo n.º 3
0
 public void CreateTag(TBL_TAG Tag)
 {
     TagRepository.Add(Tag);
 }
Exemplo n.º 4
0
 public void UpdateTag(TBL_TAG Tag)
 {
     TagRepository.Update(Tag);
 }
Exemplo n.º 5
0
 public bool IsTagExist(TBL_TAG Tag)
 {
     return(TagRepository.Get(x => x.IS_DELETED == false && x.NAME.ToUpper() == Tag.NAME.ToUpper()) == null ? false : true);
 }