Beispiel #1
0
        public IActionResult UpdateGLAccUnderSubGroup([FromBody] GlaccUnderSubGroup glaccUnderSubGroup)
        {
            if (glaccUnderSubGroup == null)
            {
                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = $"{nameof(glaccUnderSubGroup)} cannot be null"
                }));
            }

            try
            {
                GlaccUnderSubGroup result = GLHelper.UpdateUnderSubGroup(glaccUnderSubGroup);
                if (result != null)
                {
                    return(Ok(new APIResponse()
                    {
                        status = APIStatus.PASS.ToString(), response = result
                    }));
                }

                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = "Updation failed."
                }));
            }
            catch (Exception ex)
            {
                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = ex.Message
                }));
            }
        }
Beispiel #2
0
        public IActionResult DeleteGLAccUnderSubGroup(string code)
        {
            if (string.IsNullOrWhiteSpace(code))
            {
                return(BadRequest($"{nameof(code)} cannot be null"));
            }

            try
            {
                GlaccUnderSubGroup result = GLHelper.DeleteUnderSubGroup(code);
                if (result != null)
                {
                    return(Ok(new APIResponse()
                    {
                        status = APIStatus.PASS.ToString(), response = result
                    }));
                }

                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = "Deletion failed."
                }));
            }
            catch (Exception ex)
            {
                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = ex.Message
                }));
            }
        }
Beispiel #3
0
        public static GlaccUnderSubGroup UpdateUnderSubGroup(GlaccUnderSubGroup glUnderSubGroup)
        {
            try
            {
                using Repository <GlaccUnderSubGroup> repo = new Repository <GlaccUnderSubGroup>();
                repo.GlaccUnderSubGroup.Update(glUnderSubGroup);
                if (repo.SaveChanges() > 0)
                {
                    return(glUnderSubGroup);
                }

                return(null);
            }
            catch { throw; }
        }
Beispiel #4
0
        public static GlaccUnderSubGroup RegisterUnderSubGroup(GlaccUnderSubGroup glUnderSubGroup)
        {
            try
            {
                using Repository <GlaccUnderSubGroup> repo = new Repository <GlaccUnderSubGroup>();
                glUnderSubGroup.Active  = "Y";
                glUnderSubGroup.AddDate = DateTime.Now;
                repo.GlaccUnderSubGroup.Add(glUnderSubGroup);
                if (repo.SaveChanges() > 0)
                {
                    return(glUnderSubGroup);
                }

                return(null);
            }
            catch { throw; }
        }
Beispiel #5
0
        public IActionResult RegisterGlaccUnderSubGroup([FromBody] GlaccUnderSubGroup glaccUnderSubGroup)
        {
            if (glaccUnderSubGroup == null)
            {
                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = $"{nameof(glaccUnderSubGroup)}cannot be null"
                }));
            }
            try
            {
                if (GLHelper.GetGLUnderSubGroupList(glaccUnderSubGroup.UnderSubGroupCode).Count > 0)
                {
                    return(Ok(new APIResponse()
                    {
                        status = APIStatus.FAIL.ToString(), response = $"Under SubGroup Code{glaccUnderSubGroup.UnderSubGroupCode} already exists."
                    }));
                }

                GlaccUnderSubGroup result = GLHelper.RegisterUnderSubGroup(glaccUnderSubGroup);
                if (result != null)
                {
                    return(Ok(new APIResponse()
                    {
                        status = APIStatus.PASS.ToString(), response = result
                    }));
                }

                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = "Registration failed."
                }));
            }
            catch (Exception ex)
            {
                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = ex.Message
                }));
            }
        }