示例#1
0
        public HttpResponseMessage CreateBranch(AddBranchDTO branch)
        {
            HttpResponseMessage message;

            try
            {
                //  CustomerSiteMappingDataAccessLayer dal = new CustomerSiteMappingDataAccessLayer();
                var dynObj = new { result = _Customermapping.InsertBranch(branch) };
                message = Request.CreateResponse(HttpStatusCode.OK, dynObj);
            }
            catch (Exception ex)
            {
                message = Request.CreateResponse(HttpStatusCode.BadRequest, new { msgText = "Something wrong. Try Again!" });

                ErrorLog.CreateErrorMessage(ex, "CustomerSiteMapping", "CreateBranch");
            }
            return(message);
        }
        public bool InsertBranch(AddBranchDTO objBranch)
        {
            bool       res    = false;
            SqlCommand SqlCmd = new SqlCommand("spInsertBranchMaster");

            SqlCmd.CommandType = CommandType.StoredProcedure;
            SqlCmd.Parameters.AddWithValue("@CustomerId", objBranch.CustomerId);
            SqlCmd.Parameters.AddWithValue("@Branch", objBranch.Branch);
            SqlCmd.Parameters.AddWithValue("@ContactPerson", objBranch.ContactPerson);
            SqlCmd.Parameters.AddWithValue("@ContactNumber", objBranch.ContactNumber);
            SqlCmd.Parameters.AddWithValue("@Email", objBranch.Email);
            SqlCmd.Parameters.AddWithValue("@CreatedBy", objBranch.CreatedBy);
            int result = _unitOfWork.DbLayer.ExecuteNonQuery(SqlCmd);

            if (result != Int32.MaxValue)
            {
                res = true;
            }
            return(res);
        }