public async Task <IHttpActionResult> UpdateBank(PBanksDto pBanksDto)
        {
            var messages = new Messages();
            ObjectDto <PBanksDto> result = new ObjectDto <PBanksDto>();

            pBanksDto.LastModifiedDate = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById("India Standard Time"));
            db.Entry(pBanksDto).State  = EntityState.Modified;

            try
            {
                if ((await db.SaveChangesAsync()) > 0)
                {
                    result.Object    = pBanksDto;
                    result.valid     = true;
                    messages.Message = "Bank's detail updated successfully";
                    messages.Type    = Toaster.SUCCESS.ToString();
                    result.messages.Add(messages);
                }
                else
                {
                    messages.Message = "Internal Server Error";
                    result.messages.Add(messages);
                }
            }
            catch (Exception e)
            {
                messages.Message = e.Message;
                result.messages.Add(messages);
            }
            return(Ok(result));
        }
        public async Task <IHttpActionResult> AddBank(PBanksDto model)
        {
            var messages = new Messages();
            ObjectDto <PBanksDto> result = new ObjectDto <PBanksDto>();

            try
            {
                var userId = User.Identity.GetUserId();
                model.UserId           = userId;
                model.CreatedDate      = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById("India Standard Time"));
                model.LastModifiedDate = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById("India Standard Time"));

                db.Banks.Add(model);
                if ((await db.SaveChangesAsync()) > 0)
                {
                    result.Object    = model;
                    result.valid     = true;
                    messages.Message = "Bank's detail added successfully";
                    messages.Type    = Toaster.SUCCESS.ToString();
                    result.messages.Add(messages);
                }
                else
                {
                    messages.Message = "Internal Server Error";
                    result.messages.Add(messages);
                }
            }
            catch (Exception e)
            {
                messages.Message = e.Message;
                result.messages.Add(messages);
            }
            return(Ok(result));
        }
        public async Task <IHttpActionResult> DeleteBank(int id)
        {
            PBanksDto pBanksDto = await db.Banks.FindAsync(id);

            var messages = new Messages();
            ObjectDto <string> result = new ObjectDto <string>();

            if (pBanksDto == null)
            {
                messages.Message = "No record found";
                result.messages.Add(messages);
            }
            else
            {
                try
                {
                    db.Banks.Remove(pBanksDto);
                    if ((await db.SaveChangesAsync()) > 0)
                    {
                        result.valid     = true;
                        messages.Message = "Bank's detail deleted successfully";
                        messages.Type    = Toaster.SUCCESS.ToString();
                        result.messages.Add(messages);
                    }
                    else
                    {
                        messages.Message = "Internal Server Error";
                        result.messages.Add(messages);
                    }
                }
                catch (Exception e)
                {
                    messages.Message = e.Message;
                    result.messages.Add(messages);
                }
            }
            return(Ok(result));
        }