Beispiel #1
0
        public IActionResult UpdateLable(LableModel lable)
        {
            try
            {
                var result = this.lable.UpdateLable(lable);
                if (result == true)
                {
                    return(this.Ok(new ResponseModel <LableModel>()
                    {
                        Status = true, Message = "Lable updated Successfully !", Data = lable
                    }));
                }

                return(this.BadRequest(new ResponseModel <LableModel>()
                {
                    Status = false, Message = "Error While updating lable"
                }));
            }
            catch (Exception ex)
            {
                return(this.NotFound(new ResponseModel <LableModel>()
                {
                    Status = false, Message = ex.Message
                }));
            }
        }
Beispiel #2
0
        public IActionResult CreateLable(LableModel lable)
        {
            try
            {
                var result = this.lable.CreateLable(lable);
                if (result == true)
                {
                    return(this.Ok(new ResponseModel <LableModel>()
                    {
                        Status = true, Message = "New Lable added Successfully !", Data = lable
                    }));
                }

                return(this.BadRequest(new ResponseModel <LableModel>()
                {
                    Status = false, Message = "Failed to Add New Lable to Database"
                }));
            }
            catch (Exception ex)
            {
                return(this.NotFound(new ResponseModel <LableModel>()
                {
                    Status = false, Message = ex.Message
                }));
            }
        }
Beispiel #3
0
 /// <summary>
 /// Adds the lable.
 /// </summary>
 /// <param name="model">The model.</param>
 /// <returns>return true or false</returns>
 /// <exception cref="Exception"></exception>
 public bool AddLable(LableModel model)
 {
     try
     {
         bool result = this.repository.AddLable(model);
         return(result);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Beispiel #4
0
 /// <summary>
 /// Method to Update lable
 /// </summary>
 /// <param name="lable">lable parameter</param>
 /// <returns>boolean result</returns>
 public bool UpdateLable(LableModel lable)
 {
     try
     {
         bool result = this.lable.UpdateLable(lable);
         return(result);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Beispiel #5
0
 /// <summary>
 /// Updates the lables.
 /// </summary>
 /// <param name="model">The model.</param>
 /// <returns>string message</returns>
 /// <exception cref="Exception"></exception>
 public string UpdateLables(LableModel model)
 {
     try
     {
         string result = this.repository.UpdateLables(model);
         return(result);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
 /// <summary>
 /// Retrieves the lable by identifier.
 /// </summary>
 /// <param name="id">lable id</param>
 /// <returns>lable model</returns>
 /// <exception cref="Exception">ex.Message</exception>
 public LableModel RetrieveLableById(int lableId)
 {
     try
     {
         LableModel notes = this.userContext.Lable_Models.Where(x => x.LableId == lableId).SingleOrDefault();
         if (notes != null)
         {
             return(notes);
         }
         return(null);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Beispiel #7
0
 /// <summary>
 /// Retrieves the lable by identifier.
 /// </summary>
 /// <param name="id">lable id</param>
 /// <returns>
 /// particular lable
 /// </returns>
 /// <exception cref="Exception"></exception>
 public LableModel RetrieveLableById(int lableId)
 {
     try
     {
         LableModel lables = this.repository.RetrieveLableById(lableId);
         if (lables != null)
         {
             return(lables);
         }
         return(null);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
 /// <summary>
 /// Adds the notes.
 /// </summary>
 /// <param name="model">The model.</param>
 /// <returns>return true or false</returns>
 /// <exception cref="Exception"></exception>
 public bool AddLable(LableModel model)
 {
     try
     {
         if (model != null)
         {
             this.userContext.Lable_Models.Add(model);
             this.userContext.SaveChanges();
             return(true);
         }
         return(false);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
 /// <summary>
 /// Updates the lables.
 /// </summary>
 /// <param name="model">The model.</param>
 /// <returns>string message</returns>
 /// <exception cref="Exception">ex.message</exception>
 public string UpdateLables(LableModel model)
 {
     try
     {
         if (model.LableId != 0)
         {
             this.userContext.Entry(model).State = EntityState.Modified;
             this.userContext.SaveChanges();
             return("UPDATE LABLE SUCCESSFULL");
         }
         return("Updation For Lable Failed");
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Beispiel #10
0
        public ActionResult AddLable([FromBody] LableModel model)
        {
            try
            {
                bool result = this.lableManager.AddLable(model);
                if (result.Equals(true))
                {
                    return(this.Ok(new ResponseModel <LableModel>()
                    {
                        Status = true, Message = "Add Lable Sucessfully", Data = model
                    }));
                }

                return(this.BadRequest(new { Status = false, Message = "Failed to Add Lable" }));
            }
            catch (Exception ex)
            {
                return(this.NotFound(new { Status = false, Message = ex.Message }));
            }
        }
Beispiel #11
0
        public IActionResult UpdateLable([FromBody] LableModel model)
        {
            try
            {
                var result = this.lableManager.UpdateLables(model);
                if (result.Equals("UPDATE LABLE SUCCESSFULL"))
                {
                    return(this.Ok(new ResponseModel <LableModel>()
                    {
                        Status = true, Message = result, Data = model
                    }));
                }

                return(this.BadRequest(new { Status = false, Message = "Error while updating lables" }));
            }
            catch (Exception ex)
            {
                return(this.NotFound(new { Status = false, Message = ex.Message }));
            }
        }
Beispiel #12
0
        public IActionResult RetrieveLableById(int lableId)
        {
            try
            {
                LableModel result = this.lableManager.RetrieveLableById(lableId);
                if (result != null)
                {
                    return(this.Ok(new ResponseModel <LableModel>()
                    {
                        Status = true, Message = "Retrieve Lable By Id Successfully", Data = result
                    }));
                }

                return(this.BadRequest(new { Status = false, Message = "Failed to Retrieve Lable By id" }));
            }
            catch (Exception ex)
            {
                return(this.NotFound(new { Status = false, Message = ex.Message }));
            }
        }
        /// <summary>
        /// Method to update lable
        /// </summary>
        /// <param name="lable">lable parameter</param>
        /// <returns>boolean result</returns>
        public bool UpdateLable(LableModel lable)
        {
            try
            {
                bool result;
                if (lable.LableId > 0)
                {
                    this.userContext.Entry(lable).State = EntityState.Modified;
                    this.userContext.SaveChanges();
                    result = true;
                    return(result);
                }

                result = false;
                return(result);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        /// <summary>
        /// Method to Create/Add New Lable
        /// </summary>
        /// <param name="lable">lable parameter</param>
        /// <returns>boolean result</returns>
        public bool CreateLable(LableModel lable)
        {
            try
            {
                bool result;
                if (lable != null)
                {
                    this.userContext.Lables.Add(lable);
                    this.userContext.SaveChanges();
                    result = true;
                    return(result);
                }

                result = false;
                return(result);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }