Ejemplo n.º 1
0
        /// <summary>
        /// CreatedBy :sangee
        /// CreatedOn :07 Aug,2018
        /// Description :To update a existing ListItem details
        /// </summary>
        /// <param name="Group"></param>
        /// <returns></returns>
        public bool UpdateGroupListItems(GroupListItems groupListItems)
        {
            try
            {
                GroupListItems _groupListItems = _unitOfWork.GroupListItemsRepository.GetSingle(groupListItems.Id);
                if (_groupListItems == null)
                {
                    return(false);
                }
                else
                {
                    if (!string.IsNullOrEmpty(groupListItems.Name))
                    {
                        _groupListItems.Name = groupListItems.Name;
                    }
                    if (!string.IsNullOrEmpty(groupListItems.Status.ToString()))
                    {
                        _groupListItems.Status = groupListItems.Status;
                    }
                    if (!string.IsNullOrEmpty(groupListItems.Description))
                    {
                        _groupListItems.Description = groupListItems.Description;
                    }
                    if (!string.IsNullOrEmpty(groupListItems.Name))
                    {
                        _groupListItems.GroupId = groupListItems.GroupId;
                    }
                    if (!string.IsNullOrEmpty(groupListItems.CreatedBy.ToString()))
                    {
                        _groupListItems.CreatedBy = groupListItems.CreatedBy;
                    }
                    if (!string.IsNullOrEmpty(groupListItems.CreatedOn.ToString()))
                    {
                        _groupListItems.CreatedOn = groupListItems.CreatedOn;
                    }
                    if (!string.IsNullOrEmpty(groupListItems.ModifiedOn.ToString()))
                    {
                        _groupListItems.ModifiedOn = groupListItems.ModifiedOn;
                    }
                    if (!string.IsNullOrEmpty(groupListItems.ModifiedBy.ToString()))
                    {
                        _groupListItems.ModifiedBy = groupListItems.ModifiedBy;
                    }

                    _unitOfWork.Commit();
                    return(true);
                }
            }
            catch (Exception ex) { return(false); }
        }
Ejemplo n.º 2
0
 public IActionResult AddGroupListItems(GroupListItems groupListItems)
 {
     try
     {
         bool status = GroupListItemsModal.AddGroupListItems(groupListItems);
         if (status)
         {
             return(Ok());
         }
         else
         {
             return(NotFound());
         }
     }
     catch (Exception ex) { return(BadRequest(ex)); }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// CreatedBy :sangee
 /// CreatedOn :07 Aug,2018
 /// Description: To Add a new ListItem
 /// </summary>
 /// <param name="groupListItems"></param>
 /// <returns></returns>
 public bool AddGroupListItems(GroupListItems groupListItems)
 {
     try
     {
         _unitOfWork.GroupListItemsRepository.Add(groupListItems);
         _unitOfWork.Commit();
         if (groupListItems.Id > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex) { return(false); }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// CreatedBy :sangee
 /// CreatedOn : 07 Aug 2018
 /// Description :To delete a existing ListItem
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public bool DeleteGroupListItems(int id)
 {
     try
     {
         GroupListItems groupListItems = _unitOfWork.GroupListItemsRepository.GetSingle(id);
         if (groupListItems == null)
         {
             return(false);
         }
         else
         {
             _unitOfWork.GroupListItemsRepository.Delete(groupListItems);
             _unitOfWork.Commit();
             return(true);
         }
     }
     catch (Exception ex) { return(false); }
 }
Ejemplo n.º 5
0
 public IActionResult UpdateGroupListItems([FromBody] GroupListItems groupListItems)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(BadRequest(ModelState));
         }
         bool status = GroupListItemsModal.UpdateGroupListItems(groupListItems);
         if (status)
         {
             return(Ok());
         }
         else
         {
             return(NotFound());
         }
     }
     catch (Exception ex) { return(BadRequest(ex)); }
 }